mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Condition VMs - Simplification WIPpepepepe
This commit is contained in:
1 parent
805cdc6782
commit
94bde1fe38
11 files changed
+73
-103
No files matched your search
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Timers;
|
||||
using System.Windows.Media;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.DataModelExpansions;
|
||||
using Artemis.Core.Modules;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared.Services;
|
||||
@@ -19,12 +19,12 @@ namespace Artemis.UI.Shared.Input
|
||||
private readonly Module _module;
|
||||
private readonly Timer _updateTimer;
|
||||
private Brush _buttonBrush = new SolidColorBrush(Color.FromRgb(171, 71, 188));
|
||||
private DataModelPath _dataModelPath;
|
||||
private DataModelPropertiesViewModel _dataModelViewModel;
|
||||
private Type[] _filterTypes;
|
||||
private bool _isDataModelViewModelOpen;
|
||||
private bool _isEnabled = true;
|
||||
private string _placeholder = "Select a property";
|
||||
private DataModelVisualizationViewModel _selectedPropertyViewModel;
|
||||
private Type[] _filterTypes;
|
||||
|
||||
internal DataModelDynamicViewModel(Module module, ISettingsService settingsService, IDataModelUIService dataModelUIService)
|
||||
{
|
||||
@@ -81,19 +81,17 @@ namespace Artemis.UI.Shared.Input
|
||||
set => SetAndNotify(ref _isDataModelViewModelOpen, value);
|
||||
}
|
||||
|
||||
public DataModelVisualizationViewModel SelectedPropertyViewModel
|
||||
public DataModelPath DataModelPath
|
||||
{
|
||||
get => _selectedPropertyViewModel;
|
||||
set => SetAndNotify(ref _selectedPropertyViewModel, value);
|
||||
private get => _dataModelPath;
|
||||
set
|
||||
{
|
||||
if (!SetAndNotify(ref _dataModelPath, value)) return;
|
||||
NotifyOfPropertyChange(nameof(DisplayValue));
|
||||
}
|
||||
}
|
||||
|
||||
public void PopulateSelectedPropertyViewModel(DataModel datamodel, string path)
|
||||
{
|
||||
if (datamodel == null)
|
||||
SelectedPropertyViewModel = null;
|
||||
else
|
||||
SelectedPropertyViewModel = DataModelViewModel.GetChildByPath(datamodel.PluginInfo.Guid, path);
|
||||
}
|
||||
public string DisplayValue => DataModelPath.GetPropertyDescription()?.Name ?? DataModelPath.Segments.LastOrDefault()?.Identifier;
|
||||
|
||||
public void ChangeDataModel(DataModelPropertiesViewModel dataModel)
|
||||
{
|
||||
@@ -132,10 +130,16 @@ namespace Artemis.UI.Shared.Input
|
||||
if (!(context is DataModelVisualizationViewModel selected))
|
||||
return;
|
||||
|
||||
SelectedPropertyViewModel = selected;
|
||||
OnPropertySelected(new DataModelInputDynamicEventArgs(selected));
|
||||
DataModelPath = selected.DataModelPath;
|
||||
OnPropertySelected(new DataModelInputDynamicEventArgs(DataModelPath));
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_updateTimer.Stop();
|
||||
_updateTimer.Dispose();
|
||||
_updateTimer.Elapsed -= OnUpdateTimerOnElapsed;
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
@@ -147,12 +151,5 @@ namespace Artemis.UI.Shared.Input
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_updateTimer.Stop();
|
||||
_updateTimer.Dispose();
|
||||
_updateTimer.Elapsed -= OnUpdateTimerOnElapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user