From c50a572363d65a9af7793c169d95136505786462 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 26 Apr 2023 21:38:15 +0200 Subject: [PATCH] UI - Update Avalonia to preview7 UI - Update FluentAvalonia to preview7 --- src/Artemis.UI.Linux/Artemis.UI.Linux.csproj | 8 ++-- src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj | 8 ++-- .../Artemis.UI.Shared.csproj | 10 ++--- .../DataModelPicker/DataModelPicker.cs | 2 +- .../Controls/EnumComboBox.axaml.cs | 2 +- .../Shared/DataModelVisualizationViewModel.cs | 4 +- .../DryIoc/ContainerExtensions.cs | 2 +- .../Services/Builders/NotificationBuilder.cs | 18 ++++++--- .../Window/ExceptionDialogViewModel.cs | 5 +-- .../Styles/Controls/DataModelPicker.axaml | 2 +- .../Styles/Controls/GradientPicker.axaml | 6 +-- src/Artemis.UI.Shared/Utilities.cs | 6 +++ .../Artemis.UI.Windows.csproj | 10 ++--- .../Extensions/IWindowImplExtensions.cs | 18 +++++++++ .../Providers/Input/WindowsInputProvider.cs | 10 +++-- .../SkiaSharp/Vulkan/Win32VkContext.cs | 3 +- src/Artemis.UI/Artemis.UI.csproj | 14 +++---- .../BrushPropertyInputView.axaml | 2 +- .../Extensions/ProfileElementExtensions.cs | 15 ++------ src/Artemis.UI/MainWindow.axaml.cs | 1 + .../Screens/Debugger/DebugView.axaml | 2 +- .../Tabs/DataModel/DataModelDebugView.axaml | 2 +- .../PerformanceDebugPluginView.axaml | 2 +- .../PerformanceDebugProfilerView.axaml | 2 +- .../Performance/PerformanceDebugView.axaml | 2 +- .../Performance/PerformanceDebugViewModel.cs | 2 +- .../Screens/Device/DevicePropertiesView.axaml | 4 +- .../Device/Tabs/DeviceInfoTabView.axaml | 38 +++++++++---------- .../Device/Tabs/DeviceInfoTabView.axaml.cs | 11 ++++++ .../Device/Tabs/DeviceInfoTabViewModel.cs | 10 +---- .../Device/Tabs/DeviceLedsTabView.axaml | 2 +- .../Tabs/DeviceLogicalLayoutDialogView.axaml | 2 +- .../Device/Tabs/InputMappingsTabView.axaml | 2 +- ...PluginPrerequisitesInstallDialogView.axaml | 2 +- ...uginPrerequisitesUninstallDialogView.axaml | 2 +- .../Screens/Plugins/PluginSettingsView.axaml | 2 +- .../Screens/Plugins/PluginView.axaml | 2 +- .../DisplayConditionScriptView.axaml | 2 +- .../Panels/Playback/PlaybackViewModel.cs | 4 +- .../Dialogs/LayerHintsDialogView.axaml | 2 +- .../Panels/ProfileTree/ProfileTreeView.axaml | 2 +- .../Panels/ProfileTree/TreeItemViewModel.cs | 10 +---- .../Properties/Dialogs/AddEffectView.axaml | 2 +- .../Panels/Properties/PropertiesView.axaml | 2 +- .../Keyframes/TimelineKeyframeView.axaml | 2 +- .../Keyframes/TimelineKeyframeViewModel.cs | 18 ++------- .../Timeline/TimelineGroupView.axaml | 4 +- .../Timeline/TimelinePropertyView.axaml | 2 +- .../Properties/Timeline/TimelineView.axaml | 2 +- .../Properties/Timeline/TimelineViewModel.cs | 4 +- .../Tree/Dialogs/LayerBrushPresetView.axaml | 2 +- .../Properties/Tree/TreeGroupView.axaml | 2 +- .../VisualEditor/VisualEditorView.axaml | 6 +-- .../ProfileEditor/ProfileEditorView.axaml | 14 +++---- .../ScriptConfigurationCreateView.axaml | 5 ++- .../Screens/Scripting/ScriptsDialogView.axaml | 2 +- .../Screens/Settings/SettingsView.axaml | 2 +- .../Settings/Tabs/DevicesTabView.axaml | 6 ++- .../Settings/Tabs/GeneralTabView.axaml | 12 +++--- .../Settings/Tabs/PluginsTabView.axaml | 2 +- .../Settings/Tabs/ReleasesTabView.axaml | 2 +- .../ModuleActivationRequirementViewModel.cs | 2 +- .../ModuleActivationRequirementsView.axaml | 2 +- .../ProfileConfigurationEditView.axaml | 6 +-- .../Screens/Sidebar/SidebarCategoryView.axaml | 2 +- .../Screens/Sidebar/SidebarView.axaml | 4 +- .../StartupWizard/Steps/DevicesStep.axaml | 2 +- .../SurfaceEditor/SurfaceEditorView.axaml | 4 +- .../VisualScripting/NodePickerView.axaml | 2 +- .../VisualScripting/NodeScriptView.axaml | 4 +- .../VisualScripting/NodeScriptViewModel.cs | 10 +---- .../NodeScriptWindowView.axaml | 4 +- .../NodeScriptWindowViewModel.cs | 4 +- .../Screens/VisualScripting/NodeView.axaml | 8 ++-- .../Pins/InputPinCollectionView.axaml | 2 +- .../Pins/OutputPinCollectionView.axaml | 2 +- .../Artemis.VisualScripting.csproj | 6 +-- .../Screens/LayerPropertyNodeCustomView.axaml | 4 +- .../PressedKeyPositionNodeCustomView.axaml | 2 +- .../Screens/EnumEqualsNodeCustomView.axaml | 2 +- .../DisplayValueNodeCustomViewModel.cs | 2 +- .../EasingFunctionNodeCustomView.axaml | 2 +- 82 files changed, 214 insertions(+), 208 deletions(-) create mode 100644 src/Artemis.UI.Windows/Extensions/IWindowImplExtensions.cs diff --git a/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj index 210637896..757dae819 100644 --- a/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj +++ b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj @@ -16,11 +16,11 @@ - - + + - - + + diff --git a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj index 000fe864e..389802cda 100644 --- a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj +++ b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj @@ -15,11 +15,11 @@ - - + + - - + + diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj index 35cf357d8..ecaac854d 100644 --- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj +++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj @@ -10,13 +10,13 @@ - + - - - + + + - + diff --git a/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs b/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs index 621a96161..e3168eaba 100644 --- a/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs +++ b/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs @@ -308,7 +308,7 @@ public class DataModelPicker : TemplatedControl { GetDataModel(); UpdateCurrentPath(true); - _updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(200), DispatcherPriority.Normal, Update); + _updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(200), DispatcherPriority.Background, Update); _updateTimer.Start(); } diff --git a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs index ff2869519..bd702941f 100644 --- a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs @@ -91,7 +91,7 @@ public partial class EnumComboBox : UserControl protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e) { _enumComboBox = this.Get("ChildEnumComboBox"); - _enumComboBox.Items = _currentValues; + _enumComboBox.ItemsSource = _currentValues; UpdateValues(); UpdateSelection(); diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs index 59ceef437..aa1a25ab4 100644 --- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs +++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs @@ -37,8 +37,8 @@ public abstract class DataModelVisualizationViewModel : ReactiveObject, IDisposa CopyPath = ReactiveCommand.CreateFromTask(async () => { - if (Application.Current?.Clipboard != null && Path != null) - await Application.Current.Clipboard.SetTextAsync(Path); + if (Path != null) + await UI.Clipboard.SetTextAsync(Path); }); if (parent == null) diff --git a/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs b/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs index 1c86ecf84..c1e7006a7 100644 --- a/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs @@ -16,7 +16,7 @@ public static class ContainerExtensions public static void RegisterSharedUI(this IContainer container) { Assembly artemisShared = typeof(IArtemisSharedUIService).GetAssembly(); - container.RegisterMany(new[] { artemisShared }, type => type.IsAssignableTo(), Reuse.Singleton); + container.RegisterMany(new[] {artemisShared}, type => type.IsAssignableTo(), Reuse.Singleton); UI.Locator = container; } diff --git a/src/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs b/src/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs index 5ba268315..c506ee1d9 100644 --- a/src/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs +++ b/src/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs @@ -26,7 +26,8 @@ public class NotificationBuilder public NotificationBuilder(Window parent) { _parent = parent; - _infoBar = new InfoBar {Classes = Classes.Parse("notification-info-bar")}; + _infoBar = new InfoBar(); + _infoBar.Classes.Add("notification-info-bar"); } /// @@ -204,11 +205,18 @@ public class NotificationButtonBuilder internal Control Build() { + Button button = new() {Content = _text}; + button.Classes.Add("AppBarButton"); + if (_action != null) - return new Button {Content = _text, Command = ReactiveCommand.Create(() => _action()), Classes = new Classes("AppBarButton")}; - if (_command != null) - return new Button {Content = _text, Command = _command, CommandParameter = _commandParameter, Classes = new Classes("AppBarButton")}; - return new Button {Content = _text, Classes = new Classes("AppBarButton")}; + button.Command = ReactiveCommand.Create(() => _action()); + else if (_command != null) + { + button.Command = _command; + button.CommandParameter = _commandParameter; + } + + return button; } } diff --git a/src/Artemis.UI.Shared/Services/Window/ExceptionDialogViewModel.cs b/src/Artemis.UI.Shared/Services/Window/ExceptionDialogViewModel.cs index 7b256509e..06a3ea86c 100644 --- a/src/Artemis.UI.Shared/Services/Window/ExceptionDialogViewModel.cs +++ b/src/Artemis.UI.Shared/Services/Window/ExceptionDialogViewModel.cs @@ -23,10 +23,7 @@ internal class ExceptionDialogViewModel : DialogViewModelBase public async Task CopyException() { - if (Application.Current?.Clipboard == null) - return; - - await Application.Current.Clipboard.SetTextAsync(Exception.ToString()); + await UI.Clipboard.SetTextAsync(Exception.ToString()); _notificationService.CreateNotification() .WithMessage("Copied stack trace to clipboard.") .WithSeverity(NotificationSeverity.Success) diff --git a/src/Artemis.UI.Shared/Styles/Controls/DataModelPicker.axaml b/src/Artemis.UI.Shared/Styles/Controls/DataModelPicker.axaml index 67ff351ca..425316ee9 100644 --- a/src/Artemis.UI.Shared/Styles/Controls/DataModelPicker.axaml +++ b/src/Artemis.UI.Shared/Styles/Controls/DataModelPicker.axaml @@ -53,7 +53,7 @@ + ItemsSource="{Binding DataModelViewModel.Children, RelativeSource={RelativeSource TemplatedParent}}"> diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowViewModel.cs index 831c69b93..ba87decff 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowViewModel.cs @@ -67,9 +67,9 @@ public class NodeScriptWindowViewModel : NodeScriptWindowViewModelBase { _keyBindingsEnabled = Shared.UI.KeyBindingsEnabled.ToProperty(this, vm => vm.KeyBindingsEnabled).DisposeWith(d); - DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Normal, Update); + DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Background, Update); // TODO: Remove in favor of saving each time a node editor command is executed - DispatcherTimer saveTimer = new(TimeSpan.FromMinutes(2), DispatcherPriority.Normal, Save); + DispatcherTimer saveTimer = new(TimeSpan.FromMinutes(2), DispatcherPriority.Background, Save); updateTimer.Start(); saveTimer.Start(); diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeView.axaml b/src/Artemis.UI/Screens/VisualScripting/NodeView.axaml index 62838e70c..ea4dc37ad 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/NodeView.axaml @@ -75,8 +75,8 @@ IsVisible="{CompiledBinding DisplayCustomViewModelAbove}" /> - - + + - - + + - + diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml index 4c4eef93f..b98412f7a 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml @@ -14,7 +14,7 @@ Command="{CompiledBinding AddPin}"> - + diff --git a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj index 03500a177..9c0d6b679 100644 --- a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj +++ b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj @@ -8,9 +8,9 @@ - - - + + + diff --git a/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomView.axaml index bfe7ab314..4a323a590 100644 --- a/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomView.axaml @@ -8,8 +8,8 @@ x:DataType="screens:LayerPropertyNodeCustomViewModel"> - - + + diff --git a/src/Artemis.VisualScripting/Nodes/Input/Screens/PressedKeyPositionNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/Input/Screens/PressedKeyPositionNodeCustomView.axaml index f9a87a72c..bcb70f3f2 100644 --- a/src/Artemis.VisualScripting/Nodes/Input/Screens/PressedKeyPositionNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/Input/Screens/PressedKeyPositionNodeCustomView.axaml @@ -11,7 +11,7 @@ x:DataType="screens:PressedKeyPositionNodeCustomViewModel"> Layer - + diff --git a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml index b97440803..ef9b82c8e 100644 --- a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml @@ -5,7 +5,7 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.VisualScripting.Nodes.Operators.Screens.EnumEqualsNodeCustomView"> { - DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Normal, Update); + DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Background, Update); updateTimer.Start(); Disposable.Create(() => updateTimer.Stop()).DisposeWith(d); }); diff --git a/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionNodeCustomView.axaml index 0170bd620..457cb2994 100644 --- a/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionNodeCustomView.axaml @@ -6,5 +6,5 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.VisualScripting.Nodes.Transition.Screens.EasingFunctionNodeCustomView" x:DataType="screens:EasingFunctionNodeCustomViewModel"> - + \ No newline at end of file