mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Update service - Removed option to install updates without asking
Modules - Decrease CPU usage for activation requirements check by using a centralized service Devices - Reload provider when unloading a layout
This commit is contained in:
1 parent
38c04913e2
commit
fe933f60e8
17 files changed
+195
-135
No files matched your search
@@ -15,6 +15,15 @@
|
||||
d:DataContext="{d:DesignInstance {x:Type profileTree1:ProfileTreeViewModel}}">
|
||||
<materialDesign:DialogHost IsTabStop="False" Focusable="False" Identifier="ProfileTreeDialog" DialogTheme="Inherit">
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<DataTemplate x:Key="ElementDragTemplate" DataType="{x:Type treeItem:TreeItemViewModel}">
|
||||
<Border Background="{DynamicResource MaterialDesignTextFieldBoxHoverBackground}"
|
||||
Padding="10"
|
||||
CornerRadius="4">
|
||||
<TextBlock Text="{Binding ProfileElement.Name}" VerticalAlignment="Center" Foreground="{DynamicResource MaterialDesignBody}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
@@ -33,7 +42,10 @@
|
||||
dd:DragDrop.IsDragSource="True"
|
||||
dd:DragDrop.IsDropTarget="True"
|
||||
dd:DragDrop.DropHandler="{Binding}"
|
||||
ContextMenuOpening="{s:Action ContextMenuOpening}">
|
||||
dd:DragDrop.DragAdornerTemplate="{StaticResource ElementDragTemplate}"
|
||||
ContextMenuOpening="{s:Action ContextMenuOpening}"
|
||||
PreviewMouseDown="{s:Action TreeViewPreviewMouseDown}"
|
||||
PreviewMouseUp="{s:Action TreeViewPreviewMouseUp}">
|
||||
<TreeView.InputBindings>
|
||||
<KeyBinding Key="F2" Command="{s:Action RenameElement}" s:View.ActionTarget="{Binding SelectedTreeItem}" />
|
||||
<KeyBinding Key="Delete" Command="{s:Action DeleteElement}" s:View.ActionTarget="{Binding SelectedTreeItem}" />
|
||||
@@ -83,7 +95,7 @@
|
||||
</ContextMenu>
|
||||
</TreeView.ContextMenu>
|
||||
<b:Interaction.Behaviors>
|
||||
<behaviors:TreeViewSelectionBehavior SelectedItem="{Binding SelectedTreeItem}" />
|
||||
<behaviors:TreeViewSelectionBehavior SelectedItem="{Binding SelectedTreeItem, IsAsync=True}" />
|
||||
</b:Interaction.Behaviors>
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type treeItem:FolderViewModel}" ItemsSource="{Binding Items}">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
using Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem;
|
||||
@@ -15,6 +16,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree
|
||||
{
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private readonly IProfileTreeVmFactory _profileTreeVmFactory;
|
||||
private bool _draggingTreeView;
|
||||
private TreeItemViewModel _selectedTreeItem;
|
||||
private bool _updatingTree;
|
||||
|
||||
@@ -33,16 +35,25 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree
|
||||
{
|
||||
if (_updatingTree) return;
|
||||
if (!SetAndNotify(ref _selectedTreeItem, value)) return;
|
||||
if (_draggingTreeView) return;
|
||||
|
||||
if (value != null && value.ProfileElement is RenderProfileElement renderElement)
|
||||
_profileEditorService.ChangeSelectedProfileElement(renderElement);
|
||||
else
|
||||
_profileEditorService.ChangeSelectedProfileElement(null);
|
||||
ApplySelectedTreeItem();
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanPasteElement => _profileEditorService.GetCanPasteProfileElement();
|
||||
|
||||
public void TreeViewPreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
_draggingTreeView = true;
|
||||
}
|
||||
|
||||
public void TreeViewPreviewMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
_draggingTreeView = false;
|
||||
ApplySelectedTreeItem();
|
||||
}
|
||||
|
||||
protected override void OnInitialActivate()
|
||||
{
|
||||
Subscribe();
|
||||
@@ -55,6 +66,14 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
private void ApplySelectedTreeItem()
|
||||
{
|
||||
if (_selectedTreeItem != null && _selectedTreeItem.ProfileElement is RenderProfileElement renderElement)
|
||||
_profileEditorService.ChangeSelectedProfileElement(renderElement);
|
||||
else
|
||||
_profileEditorService.ChangeSelectedProfileElement(null);
|
||||
}
|
||||
|
||||
private void CreateRootFolderViewModel()
|
||||
{
|
||||
_updatingTree = true;
|
||||
@@ -64,7 +83,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree
|
||||
ActivateItem(null);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ActiveItem = _profileTreeVmFactory.FolderViewModel(folder);
|
||||
_updatingTree = false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user