mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Profile editor - Finished most of the refactor except databindings
This commit is contained in:
1 parent
7fff1a593f
commit
fea454ad12
56 files changed
+866
-459
No files matched your search
+16
-6
@@ -36,7 +36,10 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
_dataModelUIService = dataModelUIService;
|
||||
_dataBindingsVmFactory = dataBindingsVmFactory;
|
||||
|
||||
DisplayName = Registration.Property.Name.ToUpper();
|
||||
if (Registration.Member != null)
|
||||
DisplayName = Registration.Member.Name.ToUpper();
|
||||
else
|
||||
DisplayName = Registration.LayerProperty.PropertyDescription.Name.ToUpper();
|
||||
|
||||
DataBindingModes = new BindableCollection<ValueDescription>(EnumUtilities.GetAllValuesAndDescriptions(typeof(DataBindingMode)));
|
||||
EasingViewModels = new BindableCollection<TimelineEasingViewModel>();
|
||||
@@ -203,7 +206,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
|
||||
TargetSelectionViewModel.IsEnabled = true;
|
||||
TargetSelectionViewModel.PopulateSelectedPropertyViewModel(DataBinding.SourceDataModel, DataBinding.SourcePropertyPath);
|
||||
TargetSelectionViewModel.FilterTypes = new[] {DataBinding.TargetProperty.PropertyType};
|
||||
TargetSelectionViewModel.FilterTypes = new[] {DataBinding.GetTargetType()};
|
||||
|
||||
UpdateModifierViewModels();
|
||||
|
||||
@@ -225,11 +228,18 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
|
||||
|
||||
private void UpdateTestResult()
|
||||
{
|
||||
if (DataBinding == null)
|
||||
{
|
||||
TestInputValue = default;
|
||||
TestResultValue = default;
|
||||
return;
|
||||
}
|
||||
|
||||
var currentValue = TargetSelectionViewModel.SelectedPropertyViewModel?.GetCurrentValue();
|
||||
if (currentValue == null && Registration.Property.PropertyType.IsValueType)
|
||||
currentValue = Activator.CreateInstance(Registration.Property.PropertyType);
|
||||
|
||||
TestInputValue = currentValue is TProperty testInputValue ? testInputValue : default;
|
||||
if (currentValue == null)
|
||||
currentValue = default(TProperty);
|
||||
|
||||
TestInputValue = (TProperty) Convert.ChangeType(currentValue, typeof(TProperty));
|
||||
if (DataBinding != null)
|
||||
TestResultValue = DataBinding.GetValue(TestInputValue);
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user