Core - Streamlined public parts of profile creation

UI - Started adjusting the VMs for the layer refactor
This commit is contained in:
Robert authored and SpoinkyNL committed 2020-09-10 19:56:39 +02:00
1 parent 1de6fefc2a
commit c07ea09c9d
58 files changed
+694 -1196

No files matched your search

@@ -3,17 +3,17 @@ using Artemis.Core;
using Artemis.UI.Ninject.Factories;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Services;
using Stylet;
namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
{
public class DisplayConditionsViewModel : ProfileEditorPanelViewModel
public class DisplayConditionsViewModel : Conductor<DisplayConditionGroupViewModel>, IProfileEditorPanelViewModel
{
private readonly IDisplayConditionsVmFactory _displayConditionsVmFactory;
private readonly IProfileEditorService _profileEditorService;
private bool _alwaysFinishTimeline;
private bool _displayContinuously;
private RenderProfileElement _renderProfileElement;
private DisplayConditionGroupViewModel _rootGroup;
private int _transitionerIndex;
public DisplayConditionsViewModel(IProfileEditorService profileEditorService, IDisplayConditionsVmFactory displayConditionsVmFactory)
@@ -28,11 +28,6 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
set => SetAndNotify(ref _transitionerIndex, value);
}
public DisplayConditionGroupViewModel RootGroup
{
get => _rootGroup;
set => SetAndNotify(ref _rootGroup, value);
}
public RenderProfileElement RenderProfileElement
{
@@ -70,9 +65,6 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
protected override void OnDeactivate()
{
_profileEditorService.ProfileElementSelected -= ProfileEditorServiceOnProfileElementSelected;
RootGroup?.Dispose();
RootGroup = null;
}
private void ProfileEditorServiceOnProfileElementSelected(object sender, RenderProfileElementEventArgs e)
@@ -87,8 +79,7 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
if (e.RenderProfileElement == null)
{
RootGroup?.Dispose();
RootGroup = null;
ActiveItem = null;
return;
}
@@ -96,14 +87,13 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
if (e.RenderProfileElement.DisplayConditionGroup == null)
e.RenderProfileElement.DisplayConditionGroup = new DisplayConditionGroup(null);
RootGroup?.Dispose();
RootGroup = _displayConditionsVmFactory.DisplayConditionGroupViewModel(e.RenderProfileElement.DisplayConditionGroup, null, false);
RootGroup.IsRootGroup = true;
RootGroup.Update();
ActiveItem = _displayConditionsVmFactory.DisplayConditionGroupViewModel(e.RenderProfileElement.DisplayConditionGroup, false);
ActiveItem.IsRootGroup = true;
ActiveItem.Update();
// Only show the intro to conditions once, and only if the layer has no conditions
if (TransitionerIndex != 1)
TransitionerIndex = RootGroup.Children.Any() ? 1 : 0;
TransitionerIndex = ActiveItem.Items.Any() ? 1 : 0;
}
}
}