From 6087a45a18acc92dd156e7dc7fde1b2bb7d61af6 Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 8 Jun 2021 18:18:27 +0200 Subject: [PATCH] Sidebar - Made sidebar resizable (to an extend) Sidebar - Truncate long profile names Profile editor - Added shift+click on eye-icon in profile tree to focus an element Profile editor - Fixed layer property prefix/affix vertical alignment UI - Made shutdown via tray more responsive UI - Fixed several memory leaks --- src/Artemis.Core/Models/Profile/Folder.cs | 6 +- src/Artemis.Core/Models/Profile/Layer.cs | 7 +- .../Controls/DeviceVisualizer.cs | 6 +- .../Controls/ProfileConfigurationIcon.xaml | 10 +- .../StreamToBitmapImageConverter.cs | 4 +- .../Converters/StreamToSvgImageConverter.cs | 48 ++++++++++ .../Converters/ValuesAdditionConverter.cs | 20 ++++ .../PropertyInput/BoolPropertyInputView.xaml | 4 +- .../PropertyInput/BrushPropertyInputView.xaml | 4 +- .../ColorGradientPropertyInputView.xaml | 8 +- .../PropertyInput/EnumPropertyInputView.xaml | 4 +- .../PropertyInput/FloatPropertyInputView.xaml | 6 +- .../FloatRangePropertyInputView.xaml | 11 ++- .../PropertyInput/IntPropertyInputView.xaml | 7 +- .../IntRangePropertyInputView.xaml | 11 ++- .../SKColorPropertyInputView.xaml | 5 +- .../SKPointPropertyInputView.xaml | 9 +- .../SKSizePropertyInputView.xaml | 11 ++- .../ProfileTree/TreeItem/LayerView.xaml | 35 ++++--- .../ProfileTree/TreeItem/TreeItemViewModel.cs | 36 +++++++- src/Artemis.UI/Screens/RootView.xaml | 91 ++++++++++--------- src/Artemis.UI/Screens/RootViewModel.cs | 6 +- .../Dialogs/ProfileEdit/ProfileEditView.xaml | 36 ++++---- .../SidebarProfileConfigurationView.xaml | 51 ++++++++--- .../Screens/Sidebar/SidebarView.xaml | 4 +- src/Artemis.UI/Screens/TrayViewModel.cs | 5 +- 26 files changed, 298 insertions(+), 147 deletions(-) create mode 100644 src/Artemis.UI.Shared/Converters/StreamToSvgImageConverter.cs create mode 100644 src/Artemis.UI/Converters/ValuesAdditionConverter.cs diff --git a/src/Artemis.Core/Models/Profile/Folder.cs b/src/Artemis.Core/Models/Profile/Folder.cs index 8f875aaf6..b1ab731cc 100644 --- a/src/Artemis.Core/Models/Profile/Folder.cs +++ b/src/Artemis.Core/Models/Profile/Folder.cs @@ -202,13 +202,13 @@ namespace Artemis.Core foreach (BaseLayerEffect baseLayerEffect in LayerEffects.Where(e => !e.Suspended)) baseLayerEffect.PreProcess(canvas, rendererBounds, layerPaint); - canvas.SaveLayer(layerPaint); - canvas.Translate(Bounds.Left - basePosition.X, Bounds.Top - basePosition.Y); - // No point rendering if the alpha was set to zero by one of the effects if (layerPaint.Color.Alpha == 0) return; + canvas.SaveLayer(layerPaint); + canvas.Translate(Bounds.Left - basePosition.X, Bounds.Top - basePosition.Y); + // Iterate the children in reverse because the first layer must be rendered last to end up on top for (int index = Children.Count - 1; index > -1; index--) Children[index].Render(canvas, new SKPointI(Bounds.Left, Bounds.Top)); diff --git a/src/Artemis.Core/Models/Profile/Layer.cs b/src/Artemis.Core/Models/Profile/Layer.cs index 6c1b74da8..a823e6907 100644 --- a/src/Artemis.Core/Models/Profile/Layer.cs +++ b/src/Artemis.Core/Models/Profile/Layer.cs @@ -172,6 +172,9 @@ namespace Artemis.Core Disposed = true; + LayerBrushStore.LayerBrushAdded -= LayerBrushStoreOnLayerBrushAdded; + LayerBrushStore.LayerBrushRemoved -= LayerBrushStoreOnLayerBrushRemoved; + // Brush first in case it depends on any of the other disposables during it's own disposal _layerBrush?.Dispose(); _general.Dispose(); @@ -355,8 +358,6 @@ namespace Artemis.Core if (Enabled) return; - Debug.WriteLine($"Enabling {this}"); - LayerBrush?.InternalEnable(); foreach (BaseLayerEffect baseLayerEffect in LayerEffects) baseLayerEffect.InternalEnable(); @@ -370,8 +371,6 @@ namespace Artemis.Core if (!Enabled) return; - Debug.WriteLine($"Disabling {this}"); - LayerBrush?.InternalDisable(); foreach (BaseLayerEffect baseLayerEffect in LayerEffects) baseLayerEffect.InternalDisable(); diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index 130cbe0c4..053fd0fdb 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -53,7 +53,6 @@ namespace Artemis.UI.Shared // Run an update timer at 25 fps _timer = new Timer(40); - _timer.Elapsed += TimerOnTick; MouseLeftButtonUp += OnMouseLeftButtonUp; Loaded += OnLoaded; @@ -158,7 +157,8 @@ namespace Artemis.UI.Shared /// protected virtual void Dispose(bool disposing) { - if (disposing) _timer.Stop(); + if (disposing) + _timer.Dispose(); } @@ -191,6 +191,7 @@ namespace Artemis.UI.Shared private void OnUnloaded(object? sender, RoutedEventArgs e) { _timer.Stop(); + _timer.Elapsed -= TimerOnTick; if (_oldDevice != null) { @@ -222,6 +223,7 @@ namespace Artemis.UI.Shared private void OnLoaded(object? sender, RoutedEventArgs e) { _timer.Start(); + _timer.Elapsed += TimerOnTick; } private void TimerOnTick(object? sender, EventArgs e) diff --git a/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.xaml b/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.xaml index b7a60b9c8..3611f5bef 100644 --- a/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.xaml +++ b/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.xaml @@ -11,6 +11,7 @@ d:DesignHeight="450" d:DesignWidth="800"> + @@ -47,10 +48,11 @@ - + diff --git a/src/Artemis.UI.Shared/Converters/StreamToBitmapImageConverter.cs b/src/Artemis.UI.Shared/Converters/StreamToBitmapImageConverter.cs index 6e8be2be0..1c2dc963b 100644 --- a/src/Artemis.UI.Shared/Converters/StreamToBitmapImageConverter.cs +++ b/src/Artemis.UI.Shared/Converters/StreamToBitmapImageConverter.cs @@ -8,7 +8,7 @@ namespace Artemis.UI.Shared { /// /// - /// Converts into . + /// Converts bitmap file in the form of a into . /// [ValueConversion(typeof(Stream), typeof(BitmapImage))] public class StreamToBitmapImageConverter : IValueConverter @@ -16,7 +16,7 @@ namespace Artemis.UI.Shared /// public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - if (value is not Stream stream) + if (value is not Stream stream) return null; stream.Position = 0; diff --git a/src/Artemis.UI.Shared/Converters/StreamToSvgImageConverter.cs b/src/Artemis.UI.Shared/Converters/StreamToSvgImageConverter.cs new file mode 100644 index 000000000..969f6d47f --- /dev/null +++ b/src/Artemis.UI.Shared/Converters/StreamToSvgImageConverter.cs @@ -0,0 +1,48 @@ +using System; +using System.Globalization; +using System.IO; +using System.Windows.Data; +using System.Windows.Media.Imaging; +using SharpVectors.Converters; +using SharpVectors.Renderers.Wpf; + +namespace Artemis.UI.Shared +{ + /// + /// + /// Converts SVG file in the form of a into . + /// + [ValueConversion(typeof(Stream), typeof(BitmapImage))] + public class StreamToSvgImageConverter : IValueConverter + { + /// + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is not Stream stream) + return null; + + stream.Position = 0; + + StreamSvgConverter converter = new(new WpfDrawingSettings()); + using MemoryStream imageStream = new(); + converter.Convert(stream, imageStream); + + BitmapImage selectedBitmap = new(); + selectedBitmap.BeginInit(); + selectedBitmap.StreamSource = imageStream; + selectedBitmap.CacheOption = BitmapCacheOption.OnLoad; + selectedBitmap.EndInit(); + selectedBitmap.Freeze(); + + stream.Position = 0; + return selectedBitmap; + } + + + /// + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return Binding.DoNothing; + } + } +} \ No newline at end of file diff --git a/src/Artemis.UI/Converters/ValuesAdditionConverter.cs b/src/Artemis.UI/Converters/ValuesAdditionConverter.cs new file mode 100644 index 000000000..9cda8c99a --- /dev/null +++ b/src/Artemis.UI/Converters/ValuesAdditionConverter.cs @@ -0,0 +1,20 @@ +using System; +using System.Globalization; +using System.Linq; +using System.Windows.Data; + +namespace Artemis.UI.Converters +{ + public class ValuesAdditionConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + return values.Where(v => v is double).Cast().Sum(); + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/BoolPropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/BoolPropertyInputView.xaml index ebf357f9e..4371df56c 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/BoolPropertyInputView.xaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/BoolPropertyInputView.xaml @@ -11,7 +11,7 @@ - + - + \ No newline at end of file diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputView.xaml index aa4e288d3..75b8ae201 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputView.xaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputView.xaml @@ -18,7 +18,7 @@ - + - + \ No newline at end of file diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/ColorGradientPropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/ColorGradientPropertyInputView.xaml index ea3f4a60f..02ffaad0a 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/ColorGradientPropertyInputView.xaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/ColorGradientPropertyInputView.xaml @@ -10,14 +10,14 @@ d:DesignHeight="25" d:DesignWidth="800" d:DataContext="{d:DesignInstance propertyInput:ColorGradientPropertyInputViewModel}"> - + - + DialogHost="PropertyTreeDialogHost" + ToolTip="Click to edit gradient colors" /> + \ No newline at end of file diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/EnumPropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/EnumPropertyInputView.xaml index 818914562..53c5b2da3 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/EnumPropertyInputView.xaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/EnumPropertyInputView.xaml @@ -7,7 +7,7 @@ mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> - + - + \ No newline at end of file diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/FloatPropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/FloatPropertyInputView.xaml index f3d4a2b4a..784c7bea2 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/FloatPropertyInputView.xaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/FloatPropertyInputView.xaml @@ -11,7 +11,7 @@ d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance propertyInput:FloatPropertyInputViewModel}"> - + - + IsEnabled="{Binding IsEnabled}" /> + \ No newline at end of file diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/FloatRangePropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/FloatRangePropertyInputView.xaml index aabe66a33..c2c5d3501 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/FloatRangePropertyInputView.xaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/FloatRangePropertyInputView.xaml @@ -5,11 +5,12 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:s="https://github.com/canton7/Stylet" xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" + xmlns:propertyInput="clr-namespace:Artemis.UI.DefaultTypes.PropertyInput" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" - d:DataContext="{d:DesignInstance local:FloatRangePropertyInputViewModel}"> + d:DataContext="{d:DesignInstance propertyInput:FloatRangePropertyInputViewModel}"> - + + IsEnabled="{Binding IsStartEnabled}" /> - - + IsEnabled="{Binding IsEndEnabled}" /> + \ No newline at end of file diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/IntPropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/IntPropertyInputView.xaml index 4cae90771..d700033f8 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/IntPropertyInputView.xaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/IntPropertyInputView.xaml @@ -6,11 +6,12 @@ xmlns:s="https://github.com/canton7/Stylet" xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:propertyInput="clr-namespace:Artemis.UI.DefaultTypes.PropertyInput" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance propertyInput:IntPropertyInputViewModel}"> - + - + IsEnabled="{Binding IsEnabled}" /> + \ No newline at end of file diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/IntRangePropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/IntRangePropertyInputView.xaml index 40a0e815a..da9440ce1 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/IntRangePropertyInputView.xaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/IntRangePropertyInputView.xaml @@ -5,11 +5,12 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:s="https://github.com/canton7/Stylet" xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" + xmlns:propertyInput="clr-namespace:Artemis.UI.DefaultTypes.PropertyInput" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" - d:DataContext="{d:DesignInstance local:IntRangePropertyInputViewModel}"> + d:DataContext="{d:DesignInstance propertyInput:IntRangePropertyInputViewModel}"> - + + IsEnabled="{Binding IsStartEnabled}" /> - - + IsEnabled="{Binding IsEndEnabled}" /> + \ No newline at end of file diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.xaml index 6861259bb..026d4d381 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.xaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:artemis="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" xmlns:s="https://github.com/canton7/Stylet" + xmlns:propertyInput="clr-namespace:Artemis.UI.DefaultTypes.PropertyInput" mc:Ignorable="d" d:DesignHeight="25" d:DesignWidth="800" d:DataContext="{d:DesignInstance propertyInput:SKColorPropertyInputViewModel}"> @@ -12,7 +13,7 @@ - + - + \ No newline at end of file diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.xaml index 1f15efc15..06cf966ca 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.xaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.xaml @@ -5,11 +5,12 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:s="https://github.com/canton7/Stylet" xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" + xmlns:propertyInput="clr-namespace:Artemis.UI.DefaultTypes.PropertyInput" mc:Ignorable="d" d:DesignHeight="25" d:DesignWidth="800" d:DataContext="{d:DesignInstance propertyInput:SKPointPropertyInputViewModel}"> - + + IsEnabled="{Binding IsXEnabled}" /> , - + IsEnabled="{Binding IsYEnabled}" /> + \ No newline at end of file diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.xaml b/src/Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.xaml index 0f5dfc93c..a15a2b38f 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.xaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.xaml @@ -5,11 +5,12 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:s="https://github.com/canton7/Stylet" xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" + xmlns:propertyInput="clr-namespace:Artemis.UI.DefaultTypes.PropertyInput" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" - d:DataContext="{d:DesignInstance local:SKSizePropertyInputViewModel}"> + d:DataContext="{d:DesignInstance propertyInput:SKSizePropertyInputViewModel}"> - + + IsEnabled="{Binding IsHeightEnabled}" /> , - + IsEnabled="{Binding IsWidthEnabled}" /> + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/LayerView.xaml b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/LayerView.xaml index 67cf2e553..aa89223e3 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/LayerView.xaml +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/LayerView.xaml @@ -1,19 +1,19 @@  + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:s="https://github.com/canton7/Stylet" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:treeItem1="clr-namespace:Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem" + xmlns:Converters="clr-namespace:Artemis.UI.Converters" + xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" + x:Class="Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem.LayerView" + mc:Ignorable="d" + d:DesignHeight="450" d:DesignWidth="800" + d:DataContext="{d:DesignInstance {x:Type treeItem1:LayerViewModel}}"> - + @@ -72,12 +72,17 @@ + + + Toggle suspended state + Shift+click to toggle focus + + diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs index 36b1cd5ab..2ae8702b1 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using System.Windows.Input; using Artemis.Core; using Artemis.Core.LayerBrushes; using Artemis.Core.Services; @@ -18,9 +19,9 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem { private readonly IDialogService _dialogService; private readonly ILayerBrushService _layerBrushService; - private readonly IRgbService _rgbService; private readonly IProfileEditorService _profileEditorService; private readonly IProfileTreeVmFactory _profileTreeVmFactory; + private readonly IRgbService _rgbService; private ProfileElement _profileElement; protected TreeItemViewModel(ProfileElement profileElement, @@ -243,6 +244,39 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem public void SuspendedToggled() { + // If shift is held toggle focus state + if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) + { + // Get all profile elements + List elements = ProfileElement.Profile.GetAllFolders().Cast().ToList(); + elements.AddRange(ProfileElement.Profile.GetAllLayers().Cast().ToList()); + + // Separate out the targets of the focus state, the current profile element and all its parents + List targets = ProfileElement.GetAllFolders().Cast().ToList(); + targets.AddRange(ProfileElement.GetAllLayers().Cast().ToList()); + ProfileElement target = ProfileElement; + while (target != null) + { + targets.Add(target); + target = target.Parent; + } + + // If any element is suspended, untoggle focus and unsuspend everything + if (elements.Except(targets).Any(e => e.Suspended)) + { + foreach (ProfileElement profileElement in elements) + profileElement.Suspended = false; + } + // Otherwise suspend everything except the targets + else + { + foreach (ProfileElement profileElement in elements.Except(targets)) + profileElement.Suspended = true; + foreach (ProfileElement profileElement in targets) + profileElement.Suspended = false; + } + } + _profileEditorService.SaveSelectedProfileConfiguration(); } diff --git a/src/Artemis.UI/Screens/RootView.xaml b/src/Artemis.UI/Screens/RootView.xaml index f4225eeac..6f251e706 100644 --- a/src/Artemis.UI/Screens/RootView.xaml +++ b/src/Artemis.UI/Screens/RootView.xaml @@ -23,58 +23,63 @@ KeyUp="{s:Action WindowKeyUp}" MouseDown="{s:Action WindowMouseDown}" MouseUp="{s:Action WindowMouseUp}" - d:DesignHeight="640" d:DesignWidth="1200" + d:DesignHeight="640" d:DesignWidth="1200" d:DataContext="{d:DesignInstance screens:RootViewModel}"> - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - + - - - - - + + + + + + + + + + + + + + - - - + + + + + + + - + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/RootViewModel.cs b/src/Artemis.UI/Screens/RootViewModel.cs index c29653c02..377063a74 100644 --- a/src/Artemis.UI/Screens/RootViewModel.cs +++ b/src/Artemis.UI/Screens/RootViewModel.cs @@ -61,6 +61,7 @@ namespace Artemis.UI.Screens _frameTimeUpdateTimer = new Timer(500); _windowSize = _settingsService.GetSetting("UI.RootWindowSize"); + SidebarWidth = _settingsService.GetSetting("UI.SidebarWidth", new GridLength(240, GridUnitType.Star)); SidebarViewModel = sidebarViewModel; SidebarViewModel.ConductWith(this); @@ -68,6 +69,7 @@ namespace Artemis.UI.Screens WindowTitle = $"Artemis {versionAttribute?.InformationalVersion} build {Constants.BuildInfo.BuildNumberDisplay}"; } + public PluginSetting SidebarWidth { get; } public SidebarViewModel SidebarViewModel { get; } public ISnackbarMessageQueue MainMessageQueue @@ -75,7 +77,7 @@ namespace Artemis.UI.Screens get => _mainMessageQueue; set => SetAndNotify(ref _mainMessageQueue, value); } - + public string WindowTitle { get => _windowTitle; @@ -210,7 +212,7 @@ namespace Artemis.UI.Screens _frameTimeUpdateTimer.Stop(); SidebarViewModel.SelectedScreenChanged -= SidebarViewModelOnSelectedScreenChanged; - + SidebarWidth.Save(); _windowSize.Value ??= new WindowSize(); _windowSize.Value.ApplyFromWindow(_window); _windowSize.Save(); diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileEdit/ProfileEditView.xaml b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileEdit/ProfileEditView.xaml index b298b261b..2b6365387 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileEdit/ProfileEditView.xaml +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileEdit/ProfileEditView.xaml @@ -6,10 +6,8 @@ xmlns:s="https://github.com/canton7/Stylet" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:converters="clr-namespace:Artemis.UI.Converters" - xmlns:dialogs="clr-namespace:Artemis.UI.Screens.Sidebar.Dialogs" xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" xmlns:profileEdit="clr-namespace:Artemis.UI.Screens.Sidebar.Dialogs.ProfileEdit" - xmlns:svgc="http://sharpvectors.codeplex.com/svgc/" xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="280" @@ -17,9 +15,10 @@ Width="800"> - - + + + @@ -112,9 +111,9 @@ - @@ -154,14 +153,14 @@ - -