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:
Robert committed 2021-06-10 17:41:54 +02:00
1 parent 38c04913e2
commit fe933f60e8
17 files changed
+195 -135

No files matched your search

@@ -9,6 +9,7 @@ using System.Windows.Media;
using Artemis.Core;
using Artemis.Core.LayerEffects;
using Artemis.Core.Services;
using Artemis.UI.Extensions;
using Artemis.UI.Ninject.Factories;
using Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings;
using Artemis.UI.Screens.ProfileEditor.LayerProperties.LayerEffects;
@@ -220,7 +221,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
private void SelectedProfileEditorServiceOnSelectedProfileElementChanged(object sender, RenderProfileElementEventArgs e)
{
PopulateProperties(e.RenderProfileElement);
Execute.PostToUIThread(() => PopulateProperties(e.RenderProfileElement));
}
private void ProfileEditorServiceOnCurrentTimeChanged(object sender, EventArgs e)
@@ -347,7 +348,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
.ToList();
// Order the effects
List<LayerPropertyGroupViewModel> effectProperties = Items
.Where(l => l.TreeGroupViewModel.GroupType == LayerEffectRoot)
.Where(l => l.TreeGroupViewModel.GroupType == LayerEffectRoot && l.LayerPropertyGroup.LayerEffect != null)
.OrderBy(l => l.LayerPropertyGroup.LayerEffect.Order)
.ToList();
@@ -355,14 +356,16 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
for (int index = 0; index < nonEffectProperties.Count; index++)
{
LayerPropertyGroupViewModel layerPropertyGroupViewModel = nonEffectProperties[index];
((BindableCollection<LayerPropertyGroupViewModel>) Items).Move(Items.IndexOf(layerPropertyGroupViewModel), index);
if (Items.IndexOf(layerPropertyGroupViewModel) != index)
((BindableCollection<LayerPropertyGroupViewModel>) Items).Move(Items.IndexOf(layerPropertyGroupViewModel), index);
}
// Put the effect properties after, sorted by their order
for (int index = 0; index < effectProperties.Count; index++)
{
LayerPropertyGroupViewModel layerPropertyGroupViewModel = effectProperties[index];
((BindableCollection<LayerPropertyGroupViewModel>) Items).Move(Items.IndexOf(layerPropertyGroupViewModel), index + nonEffectProperties.Count);
if (Items.IndexOf(layerPropertyGroupViewModel) != index + nonEffectProperties.Count)
((BindableCollection<LayerPropertyGroupViewModel>) Items).Move(Items.IndexOf(layerPropertyGroupViewModel), index + nonEffectProperties.Count);
}
}
@@ -527,7 +530,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
Repeating = false;
}
}
private TimeSpan GetCurrentSegmentStart()
{
TimeSpan current = ProfileEditorService.CurrentTime;
@@ -637,7 +640,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
public void TimelineJump(object sender, MouseButtonEventArgs e)
{
// Get the parent grid, need that for our position
IInputElement parent = (IInputElement)VisualTreeHelper.GetParent((DependencyObject)sender);
IInputElement parent = (IInputElement) VisualTreeHelper.GetParent((DependencyObject) sender);
double x = Math.Max(0, e.GetPosition(parent).X);
TimeSpan newTime = TimeSpan.FromSeconds(x / ProfileEditorService.PixelsPerSecond);
@@ -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;
}