mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Profile editor - Reimplemented more of the timeline
This commit is contained in:
1 parent
bb687607ec
commit
e18af234c7
24 files changed
+294
-296
No files matched your search
+7
-38
@@ -6,58 +6,27 @@ using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
{
|
||||
public class DataBindingsViewModel : PropertyChangedBase, IDisposable
|
||||
public class DataBindingsViewModel<T> : Conductor<IDataBindingViewModel>.Collection.AllActive
|
||||
{
|
||||
private readonly IDataBindingsVmFactory _dataBindingsVmFactory;
|
||||
private DataBindingsTabsViewModel _dataBindingsTabsViewModel;
|
||||
private DataBindingViewModel _dataBindingViewModel;
|
||||
|
||||
public DataBindingsViewModel(BaseLayerProperty layerProperty, IDataBindingsVmFactory dataBindingsVmFactory)
|
||||
|
||||
public DataBindingsViewModel(LayerProperty<T> layerProperty, IDataBindingsVmFactory dataBindingsVmFactory)
|
||||
{
|
||||
_dataBindingsVmFactory = dataBindingsVmFactory;
|
||||
LayerProperty = layerProperty;
|
||||
Initialise();
|
||||
}
|
||||
|
||||
public BaseLayerProperty LayerProperty { get; }
|
||||
|
||||
public DataBindingViewModel DataBindingViewModel
|
||||
{
|
||||
get => _dataBindingViewModel;
|
||||
set => SetAndNotify(ref _dataBindingViewModel, value);
|
||||
}
|
||||
|
||||
public DataBindingsTabsViewModel DataBindingsTabsViewModel
|
||||
{
|
||||
get => _dataBindingsTabsViewModel;
|
||||
set => SetAndNotify(ref _dataBindingsTabsViewModel, value);
|
||||
}
|
||||
public LayerProperty<T> LayerProperty { get; }
|
||||
|
||||
private void Initialise()
|
||||
{
|
||||
DataBindingViewModel?.Dispose();
|
||||
DataBindingViewModel = null;
|
||||
DataBindingsTabsViewModel = null;
|
||||
|
||||
var registrations = LayerProperty.DataBindingRegistrations;
|
||||
if (registrations == null || registrations.Count == 0)
|
||||
return;
|
||||
var registrations = LayerProperty.GetAllDataBindingRegistrations();
|
||||
|
||||
// Create a data binding VM for each data bindable property. These VMs will be responsible for retrieving
|
||||
// and creating the actual data bindings
|
||||
if (registrations.Count == 1)
|
||||
DataBindingViewModel = _dataBindingsVmFactory.DataBindingViewModel(registrations.First());
|
||||
else
|
||||
{
|
||||
DataBindingsTabsViewModel = new DataBindingsTabsViewModel();
|
||||
foreach (var registration in registrations)
|
||||
DataBindingsTabsViewModel.Tabs.Add(_dataBindingsVmFactory.DataBindingViewModel(registration));
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DataBindingViewModel?.Dispose();
|
||||
foreach (var registration in registrations)
|
||||
ActivateItem(_dataBindingsVmFactory.DataBindingViewModel(registration));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user