diff --git a/src/Artemis.Core/Models/Profile/RenderProfileElement.cs b/src/Artemis.Core/Models/Profile/RenderProfileElement.cs
index f8d8a6d47..bd4b4994a 100644
--- a/src/Artemis.Core/Models/Profile/RenderProfileElement.cs
+++ b/src/Artemis.Core/Models/Profile/RenderProfileElement.cs
@@ -397,7 +397,7 @@ namespace Artemis.Core
if (conditionMet && !DisplayConditionMet && Timeline.IsFinished)
Timeline.JumpToStart();
// If regular conditions are no longer met, jump to the end segment if stop mode requires it
- if (!conditionMet && DisplayConditionMet && Timeline.StopMode == TimelineStopMode.SkipToEnd)
+ if (!conditionMet && Timeline.StopMode == TimelineStopMode.SkipToEnd)
Timeline.JumpToEndSegment();
}
else if (conditionMet)
diff --git a/src/Artemis.Core/Services/Storage/ProfileService.cs b/src/Artemis.Core/Services/Storage/ProfileService.cs
index 7d7a229f2..82e91c674 100644
--- a/src/Artemis.Core/Services/Storage/ProfileService.cs
+++ b/src/Artemis.Core/Services/Storage/ProfileService.cs
@@ -216,7 +216,8 @@ namespace Artemis.Core.Services
if (shouldBeActive)
{
profileConfiguration.Update();
- shouldBeActive = profileConfiguration.ActivationConditionMet;
+ if (!profileConfiguration.IsBeingEdited)
+ shouldBeActive = profileConfiguration.ActivationConditionMet;
}
try
diff --git a/src/Artemis.UI.Shared/Services/ProfileEditorService.cs b/src/Artemis.UI.Shared/Services/ProfileEditorService.cs
index 8a7016168..f3f3626ea 100644
--- a/src/Artemis.UI.Shared/Services/ProfileEditorService.cs
+++ b/src/Artemis.UI.Shared/Services/ProfileEditorService.cs
@@ -163,6 +163,9 @@ namespace Artemis.UI.Shared.Services
{
lock (_selectedProfileLock)
{
+ if (SuspendEditing)
+ throw new ArtemisSharedUIException("Cannot change the selected profile while editing is suspended");
+
if (SelectedProfileConfiguration == profileConfiguration)
return;
@@ -170,17 +173,21 @@ namespace Artemis.UI.Shared.Services
throw new ArtemisSharedUIException("Cannot select a disposed profile");
_logger.Verbose("ChangeSelectedProfileConfiguration {profile}", profileConfiguration);
+
+ if (SelectedProfileConfiguration != null)
+ SaveSelectedProfileConfiguration();
+
ChangeSelectedProfileElement(null);
ProfileConfigurationEventArgs profileConfigurationElementEvent = new(profileConfiguration, SelectedProfileConfiguration);
// No need to deactivate the profile, if needed it will be deactivated next update
if (SelectedProfileConfiguration != null)
SelectedProfileConfiguration.IsBeingEdited = false;
-
- // The new profile may need activation
+
PreviousSelectedProfileConfiguration = SelectedProfileConfiguration;
SelectedProfileConfiguration = profileConfiguration;
- ;
+
+ // The new profile may need activation
if (SelectedProfileConfiguration != null)
{
SelectedProfileConfiguration.IsBeingEdited = true;
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
index 5d6b0615f..f5ee47881 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
@@ -462,7 +462,7 @@
The profile is currently running in normal mode and the timeline cannot be edited.
- Press to toggle between editor mode and normal mode. Auto-switching can be disabled in the options menu.
+ Press to switch between editor mode and normal mode. Auto-switching can be disabled in the options menu.
diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml
index 5de7e7fee..4c71321df 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml
@@ -26,6 +26,8 @@
+
+
@@ -97,6 +99,17 @@
Command="{s:Action Paste}"
InputGestureText="Ctrl+V" />
+
-
+
SetAndNotify(ref _profileViewModel, value);
}
+ public bool SuspendedManually
+ {
+ get => _suspendedManually;
+ set => SetAndNotify(ref _suspendedManually, value);
+ }
+
public PluginSetting SidePanelsWidth => _settingsService.GetSetting("ProfileEditor.SidePanelsWidth", new GridLength(385));
public PluginSetting DataModelConditionsHeight => _settingsService.GetSetting("ProfileEditor.DataModelConditionsHeight", new GridLength(345));
public PluginSetting BottomPanelsHeight => _settingsService.GetSetting("ProfileEditor.BottomPanelsHeight", new GridLength(265));
@@ -168,6 +175,17 @@ namespace Artemis.UI.Screens.ProfileEditor
_messageService.ShowMessage("Redid profile update", "UNDO", Undo);
}
+ public void ToggleSuspend()
+ {
+ _profileEditorService.SuspendEditing = !_profileEditorService.SuspendEditing;
+ SuspendedManually = _profileEditorService.SuspendEditing;
+ }
+
+ public void ToggleAutoSuspend()
+ {
+ StopOnFocusLoss.Value = !StopOnFocusLoss.Value;
+ }
+
#region Overrides of Screen
protected override void OnInitialActivate()
@@ -194,6 +212,8 @@ namespace Artemis.UI.Screens.ProfileEditor
_profileEditorService.SelectedProfileElementChanged -= ProfileEditorServiceOnSelectedProfileElementChanged;
_eventAggregator.Unsubscribe(this);
SaveWorkspaceSettings();
+
+ _profileEditorService.SuspendEditing = false;
_profileEditorService.ChangeSelectedProfileConfiguration(null);
base.OnClose();
@@ -210,7 +230,7 @@ namespace Artemis.UI.Screens.ProfileEditor
{
NotifyOfPropertyChange(nameof(HasSelectedElement));
}
-
+
private void SaveWorkspaceSettings()
{
SidePanelsWidth.Save();
@@ -322,7 +342,7 @@ namespace Artemis.UI.Screens.ProfileEditor
///
public void Handle(MainWindowFocusChangedEvent message)
{
- if (!StopOnFocusLoss.Value)
+ if (!StopOnFocusLoss.Value || SuspendedManually)
return;
_profileEditorService.SuspendEditing = !message.IsFocused;
diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeViewModel.cs
index e9d5bed51..d0659951f 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeViewModel.cs
@@ -87,7 +87,8 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree
Execute.PostToUIThread(async () =>
{
await Task.Delay(1500);
- SelectedTreeItem = ActiveItem.GetAllChildren().FirstOrDefault(c => c.ProfileElement == _profileEditorService.SelectedProfileElement);
+ if (ActiveItem != null)
+ SelectedTreeItem = ActiveItem.GetAllChildren().FirstOrDefault(c => c.ProfileElement == _profileEditorService.SelectedProfileElement);
});
}
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileView.xaml b/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileView.xaml
index 688d828a2..26e2ae5b8 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileView.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileView.xaml
@@ -1,4 +1,4 @@
-
+
+
+
@@ -27,13 +31,16 @@
-
+
-
+
-
+
@@ -71,7 +78,7 @@
-
+
@@ -85,7 +92,7 @@
-
@@ -94,13 +101,13 @@
+ HighlightedLeds="{Binding DataContext.HighlightedLeds, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
-
-
@@ -130,9 +137,9 @@
-
+
+ Margin="10" Panel.ZIndex="1">
+ protected override void OnStateChanged(ScreenState previousState, ScreenState newState)
+ {
+ base.OnStateChanged(previousState, newState);
+ }
+
+ #endregion
+
public void WindowKeyDown(object sender, KeyEventArgs e)
{
_eventAggregator.Publish(new MainWindowKeyEvent(sender, true, e));
diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs b/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs
index 2e4a4f734..9b484250d 100644
--- a/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs
+++ b/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs
@@ -153,6 +153,8 @@ namespace Artemis.UI.Screens.Sidebar
foreach (SidebarCategoryViewModel sidebarCategoryViewModel in Items)
sidebarCategoryViewModel.SelectedProfileConfiguration = sidebarCategoryViewModel.Items.FirstOrDefault(i => i.ProfileConfiguration == profileConfiguration);
+ if (_profileEditorService.SuspendEditing)
+ _profileEditorService.SuspendEditing = false;
_profileEditorService.ChangeSelectedProfileConfiguration(profileConfiguration);
if (profileConfiguration != null)
{