mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Profiles - Save folder open/closed state
Profiles editor - Save last selected element and reselect it Profile editor - Save pan/zoom position Profile editor - Added option to resume normal playback on focus loss
This commit is contained in:
1 parent
ab754942d5
commit
8728599dcc
24 files changed
+415
-191
No files matched your search
@@ -97,6 +97,11 @@
|
||||
<b:Interaction.Behaviors>
|
||||
<behaviors:TreeViewSelectionBehavior SelectedItem="{Binding SelectedTreeItem}" />
|
||||
</b:Interaction.Behaviors>
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource MaterialDesignTreeViewItem}">
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay, FallbackValue=False}"/>
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type treeItem:FolderViewModel}" ItemsSource="{Binding Items}">
|
||||
<ContentControl s:View.Model="{Binding}" />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Artemis.Core;
|
||||
@@ -24,8 +25,6 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree
|
||||
{
|
||||
_profileEditorService = profileEditorService;
|
||||
_profileTreeVmFactory = profileTreeVmFactory;
|
||||
|
||||
CreateRootFolderViewModel();
|
||||
}
|
||||
|
||||
public TreeItemViewModel SelectedTreeItem
|
||||
@@ -33,7 +32,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree
|
||||
get => _selectedTreeItem;
|
||||
set
|
||||
{
|
||||
if (!_updatingTree && SetAndNotify(ref _selectedTreeItem, value) && !_draggingTreeView)
|
||||
if (!_updatingTree && SetAndNotify(ref _selectedTreeItem, value) && !_draggingTreeView)
|
||||
ApplySelectedTreeItem();
|
||||
}
|
||||
}
|
||||
@@ -54,6 +53,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree
|
||||
protected override void OnInitialActivate()
|
||||
{
|
||||
Subscribe();
|
||||
CreateRootFolderViewModel();
|
||||
base.OnInitialActivate();
|
||||
}
|
||||
|
||||
@@ -83,6 +83,13 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree
|
||||
|
||||
ActiveItem = _profileTreeVmFactory.FolderViewModel(folder);
|
||||
_updatingTree = false;
|
||||
|
||||
Execute.PostToUIThread(async () =>
|
||||
{
|
||||
await Task.Delay(1500);
|
||||
SelectedTreeItem = ActiveItem.GetAllChildren().FirstOrDefault(c => c.ProfileElement == _profileEditorService.SelectedProfileElement);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
#region IDropTarget
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Artemis.Core;
|
||||
using System.ComponentModel;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
using Artemis.UI.Shared.Services;
|
||||
@@ -19,5 +20,35 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
|
||||
}
|
||||
|
||||
public override bool SupportsChildren => true;
|
||||
|
||||
public override bool IsExpanded
|
||||
{
|
||||
get => ((Folder) ProfileElement).IsExpanded;
|
||||
set => ((Folder) ProfileElement).IsExpanded = value;
|
||||
}
|
||||
|
||||
private void ProfileElementOnPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(Folder.IsExpanded))
|
||||
NotifyOfPropertyChange(nameof(IsExpanded));
|
||||
}
|
||||
|
||||
#region Overrides of Screen
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInitialActivate()
|
||||
{
|
||||
ProfileElement.PropertyChanged += ProfileElementOnPropertyChanged;
|
||||
base.OnInitialActivate();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnClose()
|
||||
{
|
||||
ProfileElement.PropertyChanged -= ProfileElementOnPropertyChanged;
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -33,5 +33,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
|
||||
public Layer Layer => ProfileElement as Layer;
|
||||
public bool ShowIcons => Layer?.LayerBrush != null;
|
||||
public override bool SupportsChildren => false;
|
||||
|
||||
public override bool IsExpanded { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
|
||||
public bool CanPasteElement => _profileEditorService.GetCanPasteProfileElement();
|
||||
|
||||
public abstract bool SupportsChildren { get; }
|
||||
public abstract bool IsExpanded { get; set; }
|
||||
|
||||
public List<TreeItemViewModel> GetAllChildren()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user