mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-01-01 02:03:32 +00:00
Implemented BottomToTop again
This commit is contained in:
parent
de0ff1ebad
commit
15275c83a0
@ -355,7 +355,7 @@
|
|||||||
<Compile Include="Managers\LoopManager.cs" />
|
<Compile Include="Managers\LoopManager.cs" />
|
||||||
<Compile Include="Managers\LuaManager.cs" />
|
<Compile Include="Managers\LuaManager.cs" />
|
||||||
<Compile Include="Managers\MainManager.cs" />
|
<Compile Include="Managers\MainManager.cs" />
|
||||||
<Compile Include="Managers\ProfileManager.cs" />
|
<Compile Include="Managers\PreviewManager.cs" />
|
||||||
<Compile Include="Modules\Abstract\ModuleDataModel.cs" />
|
<Compile Include="Modules\Abstract\ModuleDataModel.cs" />
|
||||||
<Compile Include="Modules\Abstract\ModuleModel.cs" />
|
<Compile Include="Modules\Abstract\ModuleModel.cs" />
|
||||||
<Compile Include="Modules\Abstract\ModuleSettings.cs" />
|
<Compile Include="Modules\Abstract\ModuleSettings.cs" />
|
||||||
@ -622,6 +622,7 @@
|
|||||||
<Compile Include="Utilities\Converters\NinjectCustomConverter.cs" />
|
<Compile Include="Utilities\Converters\NinjectCustomConverter.cs" />
|
||||||
<Compile Include="Utilities\Converters\ValueConverters.cs" />
|
<Compile Include="Utilities\Converters\ValueConverters.cs" />
|
||||||
<Compile Include="Utilities\DataReaders\DllManager.cs" />
|
<Compile Include="Utilities\DataReaders\DllManager.cs" />
|
||||||
|
<Compile Include="Utilities\EditorHelper.cs" />
|
||||||
<Compile Include="Utilities\ExtensionMethods.cs" />
|
<Compile Include="Utilities\ExtensionMethods.cs" />
|
||||||
<Compile Include="Utilities\GameState\GameDataReceivedEventArgs.cs" />
|
<Compile Include="Utilities\GameState\GameDataReceivedEventArgs.cs" />
|
||||||
<Compile Include="Utilities\GameState\GameStateWebServer.cs" />
|
<Compile Include="Utilities\GameState\GameStateWebServer.cs" />
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Artemis.InjectionModules
|
|||||||
Bind<LoopManager>().ToSelf().InSingletonScope();
|
Bind<LoopManager>().ToSelf().InSingletonScope();
|
||||||
Bind<DeviceManager>().ToSelf().InSingletonScope();
|
Bind<DeviceManager>().ToSelf().InSingletonScope();
|
||||||
Bind<ModuleManager>().ToSelf().InSingletonScope();
|
Bind<ModuleManager>().ToSelf().InSingletonScope();
|
||||||
Bind<ProfileManager>().ToSelf().InSingletonScope();
|
Bind<PreviewManager>().ToSelf().InSingletonScope();
|
||||||
Bind<LuaManager>().ToSelf().InSingletonScope();
|
Bind<LuaManager>().ToSelf().InSingletonScope();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,14 +22,14 @@ namespace Artemis.Managers
|
|||||||
private readonly Timer _processTimer;
|
private readonly Timer _processTimer;
|
||||||
|
|
||||||
public MainManager(ILogger logger, LoopManager loopManager, DeviceManager deviceManager,
|
public MainManager(ILogger logger, LoopManager loopManager, DeviceManager deviceManager,
|
||||||
ModuleManager moduleManager, ProfileManager profileManager, PipeServer pipeServer,
|
ModuleManager moduleManager, PreviewManager previewManager, PipeServer pipeServer,
|
||||||
GameStateWebServer gameStateWebServer)
|
GameStateWebServer gameStateWebServer)
|
||||||
{
|
{
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
LoopManager = loopManager;
|
LoopManager = loopManager;
|
||||||
DeviceManager = deviceManager;
|
DeviceManager = deviceManager;
|
||||||
ModuleManager = moduleManager;
|
ModuleManager = moduleManager;
|
||||||
ProfileManager = profileManager;
|
PreviewManager = previewManager;
|
||||||
PipeServer = pipeServer;
|
PipeServer = pipeServer;
|
||||||
|
|
||||||
_processTimer = new Timer(1000);
|
_processTimer = new Timer(1000);
|
||||||
@ -64,7 +64,7 @@ namespace Artemis.Managers
|
|||||||
public LoopManager LoopManager { get; }
|
public LoopManager LoopManager { get; }
|
||||||
public DeviceManager DeviceManager { get; set; }
|
public DeviceManager DeviceManager { get; set; }
|
||||||
public ModuleManager ModuleManager { get; set; }
|
public ModuleManager ModuleManager { get; set; }
|
||||||
public ProfileManager ProfileManager { get; set; }
|
public PreviewManager PreviewManager { get; set; }
|
||||||
|
|
||||||
public PipeServer PipeServer { get; set; }
|
public PipeServer PipeServer { get; set; }
|
||||||
public GameStateWebServer GameStateWebServer { get; set; }
|
public GameStateWebServer GameStateWebServer { get; set; }
|
||||||
|
|||||||
@ -9,7 +9,7 @@ using Ninject.Extensions.Logging;
|
|||||||
|
|
||||||
namespace Artemis.Managers
|
namespace Artemis.Managers
|
||||||
{
|
{
|
||||||
public class ProfileManager
|
public class PreviewManager
|
||||||
{
|
{
|
||||||
private readonly DeviceManager _deviceManager;
|
private readonly DeviceManager _deviceManager;
|
||||||
private readonly GeneralSettings _generalSettings;
|
private readonly GeneralSettings _generalSettings;
|
||||||
@ -17,7 +17,7 @@ namespace Artemis.Managers
|
|||||||
private readonly LoopManager _loopManager;
|
private readonly LoopManager _loopManager;
|
||||||
private readonly ModuleManager _moduleManager;
|
private readonly ModuleManager _moduleManager;
|
||||||
|
|
||||||
public ProfileManager(ILogger logger, ModuleManager moduleManager, DeviceManager deviceManager,
|
public PreviewManager(ILogger logger, ModuleManager moduleManager, DeviceManager deviceManager,
|
||||||
LoopManager loopManager)
|
LoopManager loopManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
@ -32,7 +32,7 @@ namespace Artemis.Managers
|
|||||||
profilePreviewTimer.Elapsed += SetupProfilePreview;
|
profilePreviewTimer.Elapsed += SetupProfilePreview;
|
||||||
profilePreviewTimer.Start();
|
profilePreviewTimer.Start();
|
||||||
|
|
||||||
_logger.Info("Intialized ProfileManager");
|
_logger.Info("Intialized PreviewManager");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ModuleViewModel> PreviewViewModules { get; set; }
|
public List<ModuleViewModel> PreviewViewModules { get; set; }
|
||||||
@ -27,7 +27,6 @@ namespace Artemis.Modules.Abstract
|
|||||||
ModuleModel = moduleModel;
|
ModuleModel = moduleModel;
|
||||||
Settings = moduleModel.Settings;
|
Settings = moduleModel.Settings;
|
||||||
|
|
||||||
|
|
||||||
_mainManager.EnabledChanged += MainManagerOnEnabledChanged;
|
_mainManager.EnabledChanged += MainManagerOnEnabledChanged;
|
||||||
_moduleManager.EffectChanged += ModuleManagerOnModuleChanged;
|
_moduleManager.EffectChanged += ModuleManagerOnModuleChanged;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,6 @@ namespace Artemis.Profiles.Layers.Types.Audio.AudioCapturing
|
|||||||
public class AudioCapture
|
public class AudioCapture
|
||||||
{
|
{
|
||||||
private const FftSize FftSize = CSCore.DSP.FftSize.Fft4096;
|
private const FftSize FftSize = CSCore.DSP.FftSize.Fft4096;
|
||||||
private readonly Timer _activityTimer;
|
|
||||||
private readonly Timer _volumeTimer;
|
private readonly Timer _volumeTimer;
|
||||||
private readonly double[] _volumeValues;
|
private readonly double[] _volumeValues;
|
||||||
private SingleSpectrum _singleSpectrum;
|
private SingleSpectrum _singleSpectrum;
|
||||||
@ -31,17 +30,15 @@ namespace Artemis.Profiles.Layers.Types.Audio.AudioCapturing
|
|||||||
|
|
||||||
_volumeValues = new double[5];
|
_volumeValues = new double[5];
|
||||||
_volumeIndex = 0;
|
_volumeIndex = 0;
|
||||||
_activityTimer = new Timer(1000);
|
|
||||||
_activityTimer.Elapsed += ActivityTimerOnElapsed;
|
|
||||||
_volumeTimer = new Timer(200);
|
_volumeTimer = new Timer(200);
|
||||||
_volumeTimer.Elapsed += VolumeTimerOnElapsed;
|
_volumeTimer.Elapsed += VolumeTimerOnElapsed;
|
||||||
|
|
||||||
|
Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public double DesiredAverage { get; set; }
|
|
||||||
|
|
||||||
public bool MayStop { get; set; }
|
|
||||||
|
|
||||||
public ILogger Logger { get; }
|
public ILogger Logger { get; }
|
||||||
|
public MMDevice Device { get; }
|
||||||
|
public double DesiredAverage { get; set; }
|
||||||
|
|
||||||
public float Volume
|
public float Volume
|
||||||
{
|
{
|
||||||
@ -49,9 +46,6 @@ namespace Artemis.Profiles.Layers.Types.Audio.AudioCapturing
|
|||||||
set { _volume.Volume = value; }
|
set { _volume.Volume = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public MMDevice Device { get; }
|
|
||||||
public bool Running { get; set; }
|
|
||||||
|
|
||||||
private void VolumeTimerOnElapsed(object sender, ElapsedEventArgs e)
|
private void VolumeTimerOnElapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
if (Volume <= 0)
|
if (Volume <= 0)
|
||||||
@ -95,20 +89,6 @@ namespace Artemis.Profiles.Layers.Types.Audio.AudioCapturing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ActivityTimerOnElapsed(object sender, ElapsedEventArgs e)
|
|
||||||
{
|
|
||||||
// If MayStop is true for longer than a second, this will stop the audio capture
|
|
||||||
if (MayStop)
|
|
||||||
{
|
|
||||||
Stop();
|
|
||||||
MayStop = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MayStop = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public LineSpectrum GetLineSpectrum(int barCount, ScalingStrategy scalingStrategy)
|
public LineSpectrum GetLineSpectrum(int barCount, ScalingStrategy scalingStrategy)
|
||||||
{
|
{
|
||||||
return new LineSpectrum(FftSize)
|
return new LineSpectrum(FftSize)
|
||||||
@ -121,39 +101,8 @@ namespace Artemis.Profiles.Layers.Types.Audio.AudioCapturing
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop()
|
private void Start()
|
||||||
{
|
{
|
||||||
if (!Running)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Logger.Debug("Stopping audio capture for device: {0}", Device?.FriendlyName ?? "default");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_activityTimer.Stop();
|
|
||||||
_volumeTimer.Stop();
|
|
||||||
|
|
||||||
_soundIn.Stop();
|
|
||||||
_soundIn.Dispose();
|
|
||||||
_source.Dispose();
|
|
||||||
_soundIn = null;
|
|
||||||
_source = null;
|
|
||||||
|
|
||||||
Running = false;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Logger.Warn(e, "Failed to stop WASAPI audio capture");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Pulse()
|
|
||||||
{
|
|
||||||
MayStop = false;
|
|
||||||
|
|
||||||
if (Running)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Logger.Debug("Starting audio capture for device: {0}", Device?.FriendlyName ?? "default");
|
Logger.Debug("Starting audio capture for device: {0}", Device?.FriendlyName ?? "default");
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -188,12 +137,8 @@ namespace Artemis.Profiles.Layers.Types.Audio.AudioCapturing
|
|||||||
|
|
||||||
_singleSpectrum = new SingleSpectrum(FftSize, _spectrumProvider);
|
_singleSpectrum = new SingleSpectrum(FftSize, _spectrumProvider);
|
||||||
|
|
||||||
_activityTimer.Start();
|
|
||||||
_volumeTimer.Start();
|
_volumeTimer.Start();
|
||||||
|
|
||||||
_soundIn.Start();
|
_soundIn.Start();
|
||||||
Running = true;
|
|
||||||
MayStop = false;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -57,7 +57,7 @@ namespace Artemis.Profiles.Layers.Types.Audio
|
|||||||
|
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case Direction.BottomToTop:
|
case Direction.TopToBottom:
|
||||||
for (var index = 0; index < _lineValues.Count; index++)
|
for (var index = 0; index < _lineValues.Count; index++)
|
||||||
{
|
{
|
||||||
var clipRect = new Rect((parentX + index)*4, parentY*4, 4, _lineValues[index]*4);
|
var clipRect = new Rect((parentX + index)*4, parentY*4, 4, _lineValues[index]*4);
|
||||||
@ -65,10 +65,11 @@ namespace Artemis.Profiles.Layers.Types.Audio
|
|||||||
barGeometry = Geometry.Combine(barGeometry, barRect, CombineMode, Transform.Identity);
|
barGeometry = Geometry.Combine(barGeometry, barRect, CombineMode, Transform.Identity);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Direction.TopToBottom:
|
case Direction.BottomToTop:
|
||||||
for (var index = 0; index < _lineValues.Count; index++)
|
for (var index = 0; index < _lineValues.Count; index++)
|
||||||
{
|
{
|
||||||
var clipRect = new Rect((parentX + index)*4, parentY*4, 4, _lineValues[index]*4);
|
var clipRect = new Rect((parentX + index)*4, parentY*4, 4, _lineValues[index]*4);
|
||||||
|
clipRect.Y = clipRect.Y + layerModel.Height*4 - clipRect.Height;
|
||||||
var barRect = new RectangleGeometry(clipRect);
|
var barRect = new RectangleGeometry(clipRect);
|
||||||
barGeometry = Geometry.Combine(barGeometry, barRect, CombineMode, Transform.Identity);
|
barGeometry = Geometry.Combine(barGeometry, barRect, CombineMode, Transform.Identity);
|
||||||
}
|
}
|
||||||
@ -116,9 +117,6 @@ namespace Artemis.Profiles.Layers.Types.Audio
|
|||||||
currentHeight = layerModel.Width;
|
currentHeight = layerModel.Width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let audio capture know it is being listened to
|
|
||||||
_audioCapture.Pulse();
|
|
||||||
|
|
||||||
if (_lines != currentLines || _lineSpectrum == null)
|
if (_lines != currentLines || _lineSpectrum == null)
|
||||||
{
|
{
|
||||||
_lines = currentLines;
|
_lines = currentLines;
|
||||||
|
|||||||
12
Artemis/Artemis/Utilities/EditorHelper.cs
Normal file
12
Artemis/Artemis/Utilities/EditorHelper.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Artemis.Utilities
|
||||||
|
{
|
||||||
|
public static class EditorHelper
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,14 +10,14 @@ namespace Artemis.ViewModels
|
|||||||
{
|
{
|
||||||
private readonly List<ModuleViewModel> _vms;
|
private readonly List<ModuleViewModel> _vms;
|
||||||
|
|
||||||
public GeneralViewModel(List<ModuleViewModel> moduleViewModels, ProfileManager profileManager)
|
public GeneralViewModel(List<ModuleViewModel> moduleViewModels, PreviewManager previewManager)
|
||||||
{
|
{
|
||||||
DisplayName = "General";
|
DisplayName = "General";
|
||||||
_vms = moduleViewModels.Where(m => !m.ModuleModel.IsOverlay && !m.ModuleModel.IsBoundToProcess)
|
_vms = moduleViewModels.Where(m => !m.ModuleModel.IsOverlay && !m.ModuleModel.IsBoundToProcess)
|
||||||
.OrderBy(m => m.DisplayName).ToList();
|
.OrderBy(m => m.DisplayName).ToList();
|
||||||
|
|
||||||
profileManager.PreviewViewModules.Clear();
|
previewManager.PreviewViewModules.Clear();
|
||||||
profileManager.PreviewViewModules.AddRange(moduleViewModels.Where(m => m.UsesProfileEditor));
|
previewManager.PreviewViewModules.AddRange(moduleViewModels.Where(m => m.UsesProfileEditor));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnActivate()
|
protected override void OnActivate()
|
||||||
|
|||||||
@ -45,6 +45,8 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
private ObservableCollection<string> _profileNames;
|
private ObservableCollection<string> _profileNames;
|
||||||
private bool _saving;
|
private bool _saving;
|
||||||
private FileSystemWatcher _watcher;
|
private FileSystemWatcher _watcher;
|
||||||
|
private ProfileViewModel _profileViewModel;
|
||||||
|
private LayerModel _selectedLayer;
|
||||||
|
|
||||||
public ProfileEditorViewModel(DeviceManager deviceManager, LuaManager luaManager, ModuleModel moduleModel,
|
public ProfileEditorViewModel(DeviceManager deviceManager, LuaManager luaManager, ModuleModel moduleModel,
|
||||||
ProfileViewModel profileViewModel, MetroDialogService dialogService, WindowService windowService)
|
ProfileViewModel profileViewModel, MetroDialogService dialogService, WindowService windowService)
|
||||||
@ -62,13 +64,22 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
ProfileViewModel.ModuleModel = _moduleModel;
|
ProfileViewModel.ModuleModel = _moduleModel;
|
||||||
|
|
||||||
PropertyChanged += EditorStateHandler;
|
PropertyChanged += EditorStateHandler;
|
||||||
ProfileViewModel.PropertyChanged += LayerSelectedHandler;
|
|
||||||
_deviceManager.OnKeyboardChanged += DeviceManagerOnOnKeyboardChanged;
|
_deviceManager.OnKeyboardChanged += DeviceManagerOnOnKeyboardChanged;
|
||||||
_moduleModel.ProfileChanged += ModuleModelOnProfileChanged;
|
_moduleModel.ProfileChanged += ModuleModelOnProfileChanged;
|
||||||
LoadProfiles();
|
LoadProfiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProfileViewModel ProfileViewModel { get; set; }
|
public ProfileViewModel ProfileViewModel
|
||||||
|
{
|
||||||
|
get { return _profileViewModel; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Equals(value, _profileViewModel)) return;
|
||||||
|
_profileViewModel = value;
|
||||||
|
NotifyOfPropertyChange();
|
||||||
|
NotifyOfPropertyChange(nameof(LayerSelected));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool EditorEnabled
|
public bool EditorEnabled
|
||||||
=>
|
=>
|
||||||
@ -76,6 +87,21 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
_deviceManager.ActiveKeyboard != null;
|
_deviceManager.ActiveKeyboard != null;
|
||||||
|
|
||||||
public ProfileModel SelectedProfile => _moduleModel?.ProfileModel;
|
public ProfileModel SelectedProfile => _moduleModel?.ProfileModel;
|
||||||
|
public LayerModel SelectedLayer
|
||||||
|
{
|
||||||
|
get { return _selectedLayer; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_profileViewModel != null)
|
||||||
|
_profileViewModel.SelectedLayer = value;
|
||||||
|
if (Equals(value, _selectedLayer))
|
||||||
|
return;
|
||||||
|
|
||||||
|
_selectedLayer = value;
|
||||||
|
NotifyOfPropertyChange(() => SelectedLayer);
|
||||||
|
NotifyOfPropertyChange(() => LayerSelected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ObservableCollection<string> ProfileNames
|
public ObservableCollection<string> ProfileNames
|
||||||
{
|
{
|
||||||
@ -126,7 +152,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
public PreviewSettings? PreviewSettings => _deviceManager.ActiveKeyboard?.PreviewSettings;
|
public PreviewSettings? PreviewSettings => _deviceManager.ActiveKeyboard?.PreviewSettings;
|
||||||
|
|
||||||
public bool ProfileSelected => SelectedProfile != null;
|
public bool ProfileSelected => SelectedProfile != null;
|
||||||
public bool LayerSelected => SelectedProfile != null && ProfileViewModel.SelectedLayer != null;
|
public bool LayerSelected => SelectedProfile != null && SelectedLayer != null;
|
||||||
|
|
||||||
public void DragOver(IDropInfo dropInfo)
|
public void DragOver(IDropInfo dropInfo)
|
||||||
{
|
{
|
||||||
@ -230,7 +256,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
|
|
||||||
public void EditLayerFromDoubleClick()
|
public void EditLayerFromDoubleClick()
|
||||||
{
|
{
|
||||||
if (ProfileViewModel.SelectedLayer?.LayerType is FolderType)
|
if (SelectedLayer?.LayerType is FolderType)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EditLayer();
|
EditLayer();
|
||||||
@ -238,10 +264,10 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
|
|
||||||
public void EditLayer()
|
public void EditLayer()
|
||||||
{
|
{
|
||||||
if (ProfileViewModel.SelectedLayer == null)
|
if (SelectedLayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var selectedLayer = ProfileViewModel.SelectedLayer;
|
var selectedLayer = SelectedLayer;
|
||||||
EditLayer(selectedLayer);
|
EditLayer(selectedLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +316,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
if (SelectedProfile == null)
|
if (SelectedProfile == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var layer = SelectedProfile.AddLayer(ProfileViewModel.SelectedLayer);
|
var layer = SelectedProfile.AddLayer(SelectedLayer);
|
||||||
UpdateLayerList(layer);
|
UpdateLayerList(layer);
|
||||||
|
|
||||||
return layer;
|
return layer;
|
||||||
@ -314,7 +340,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void RemoveLayer()
|
public void RemoveLayer()
|
||||||
{
|
{
|
||||||
RemoveLayer(ProfileViewModel.SelectedLayer);
|
RemoveLayer(SelectedLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -368,10 +394,10 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void CloneLayer()
|
public void CloneLayer()
|
||||||
{
|
{
|
||||||
if (ProfileViewModel.SelectedLayer == null)
|
if (SelectedLayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CloneLayer(ProfileViewModel.SelectedLayer);
|
CloneLayer(SelectedLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -390,7 +416,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
{
|
{
|
||||||
// Update the UI
|
// Update the UI
|
||||||
Layers.Clear();
|
Layers.Clear();
|
||||||
ProfileViewModel.SelectedLayer = null;
|
SelectedLayer = null;
|
||||||
|
|
||||||
if (SelectedProfile != null)
|
if (SelectedProfile != null)
|
||||||
Layers.AddRange(SelectedProfile.Layers);
|
Layers.AddRange(SelectedProfile.Layers);
|
||||||
@ -402,7 +428,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
Task.Factory.StartNew(() =>
|
Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
ProfileViewModel.SelectedLayer = selectModel;
|
SelectedLayer = selectModel;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -680,14 +706,6 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
NotifyOfPropertyChange(() => ProfileSelected);
|
NotifyOfPropertyChange(() => ProfileSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LayerSelectedHandler(object sender, PropertyChangedEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.PropertyName != "SelectedLayer")
|
|
||||||
return;
|
|
||||||
|
|
||||||
NotifyOfPropertyChange(() => LayerSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveSelectedProfile()
|
public void SaveSelectedProfile()
|
||||||
{
|
{
|
||||||
if (_saving || SelectedProfile == null || _deviceManager.ChangingKeyboard)
|
if (_saving || SelectedProfile == null || _deviceManager.ChangingKeyboard)
|
||||||
|
|||||||
@ -32,7 +32,6 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
private DrawingImage _keyboardPreview;
|
private DrawingImage _keyboardPreview;
|
||||||
private Cursor _keyboardPreviewCursor;
|
private Cursor _keyboardPreviewCursor;
|
||||||
private bool _resizing;
|
private bool _resizing;
|
||||||
private LayerModel _selectedLayer;
|
|
||||||
private bool _showAll;
|
private bool _showAll;
|
||||||
|
|
||||||
public ProfileViewModel(DeviceManager deviceManager, LoopManager loopManager)
|
public ProfileViewModel(DeviceManager deviceManager, LoopManager loopManager)
|
||||||
@ -47,18 +46,9 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ModuleModel ModuleModel { get; set; }
|
public ModuleModel ModuleModel { get; set; }
|
||||||
public ProfileModel SelectedProfile => ModuleModel?.ProfileModel;
|
public LayerModel SelectedLayer { get; set; }
|
||||||
|
|
||||||
public LayerModel SelectedLayer
|
public ProfileModel SelectedProfile => ModuleModel?.ProfileModel;
|
||||||
{
|
|
||||||
get { return _selectedLayer; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (Equals(value, _selectedLayer)) return;
|
|
||||||
_selectedLayer = value;
|
|
||||||
NotifyOfPropertyChange(() => SelectedLayer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DrawingImage KeyboardPreview
|
public DrawingImage KeyboardPreview
|
||||||
{
|
{
|
||||||
@ -380,10 +370,13 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
Disposed = true;
|
||||||
_loopManager.RenderCompleted -= LoopManagerOnRenderCompleted;
|
_loopManager.RenderCompleted -= LoopManagerOnRenderCompleted;
|
||||||
_deviceManager.OnKeyboardChanged -= DeviceManagerOnOnKeyboardChanged;
|
_deviceManager.OnKeyboardChanged -= DeviceManagerOnOnKeyboardChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Disposed { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ namespace Artemis.ViewModels
|
|||||||
dialog.SetIndeterminate();
|
dialog.SetIndeterminate();
|
||||||
|
|
||||||
while (MainManager.DeviceManager.ChangingKeyboard)
|
while (MainManager.DeviceManager.ChangingKeyboard)
|
||||||
await Task.Delay(10);
|
await Task.Delay(1000);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@ -185,7 +185,7 @@
|
|||||||
cal:Message.Attach="[Event MouseDoubleClick] = [Action EditLayerFromDoubleClick]">
|
cal:Message.Attach="[Event MouseDoubleClick] = [Action EditLayerFromDoubleClick]">
|
||||||
<i:Interaction.Behaviors>
|
<i:Interaction.Behaviors>
|
||||||
<itemBehaviours:BindableSelectedItemBehavior
|
<itemBehaviours:BindableSelectedItemBehavior
|
||||||
SelectedItem="{Binding ProfileViewModel.SelectedLayer, Mode=TwoWay}" />
|
SelectedItem="{Binding SelectedLayer, Mode=TwoWay}" />
|
||||||
</i:Interaction.Behaviors>
|
</i:Interaction.Behaviors>
|
||||||
<TreeView.Resources>
|
<TreeView.Resources>
|
||||||
<ResourceDictionary
|
<ResourceDictionary
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user