mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Data bindings - Added copy/pasting of data binding
This commit is contained in:
1 parent
b3b7d6819d
commit
a0faeb21fd
8 files changed
+136
-75
No files matched your search
+6
-15
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Extensions;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
@@ -16,7 +16,6 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
||||
private readonly IDataModelConditionsVmFactory _dataModelConditionsVmFactory;
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private bool _isEventGroup;
|
||||
private bool _isInitialized;
|
||||
private bool _isRootGroup;
|
||||
|
||||
public DataModelConditionGroupViewModel(DataModelConditionGroup dataModelConditionGroup,
|
||||
@@ -30,12 +29,6 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
||||
_dataModelConditionsVmFactory = dataModelConditionsVmFactory;
|
||||
|
||||
Items.CollectionChanged += (_, _) => NotifyOfPropertyChange(nameof(DisplayBooleanOperator));
|
||||
|
||||
Execute.PostToUIThread(async () =>
|
||||
{
|
||||
await Task.Delay(50);
|
||||
IsInitialized = true;
|
||||
});
|
||||
}
|
||||
|
||||
public ConditionGroupType GroupType { get; }
|
||||
@@ -63,12 +56,6 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsInitialized
|
||||
{
|
||||
get => _isInitialized;
|
||||
set => SetAndNotify(ref _isInitialized, value);
|
||||
}
|
||||
|
||||
public bool DisplayBooleanOperator => Items.Count > 1;
|
||||
public bool DisplayEvaluationResult => GroupType == ConditionGroupType.General && !IsEventGroup;
|
||||
public string SelectedBooleanOperator => DataModelConditionGroup.BooleanOperator.Humanize();
|
||||
@@ -132,7 +119,9 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
||||
{
|
||||
NotifyOfPropertyChange(nameof(SelectedBooleanOperator));
|
||||
// Remove VMs of effects no longer applied on the layer
|
||||
Items.RemoveRange(Items.Where(c => !DataModelConditionGroup.Children.Contains(c.Model)).ToList());
|
||||
List<DataModelConditionViewModel> toRemove = Items.Where(c => !DataModelConditionGroup.Children.Contains(c.Model)).ToList();
|
||||
if (toRemove.Any())
|
||||
Items.RemoveRange(toRemove);
|
||||
|
||||
foreach (DataModelConditionPart childModel in Model.Children)
|
||||
{
|
||||
@@ -169,8 +158,10 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
||||
|
||||
IsEventGroup = Items.Any(i => i is DataModelConditionEventViewModel);
|
||||
if (IsEventGroup)
|
||||
{
|
||||
if (DataModelConditionGroup.BooleanOperator != BooleanOperator.And)
|
||||
SelectBooleanOperator("And");
|
||||
}
|
||||
|
||||
OnUpdated();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user