From 87dce788d7a348faebca497055dec66260532811 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 19 May 2021 17:31:36 +0200 Subject: [PATCH] UI - Added --disable-forced-shutdown which does just that UI - Don't kill new instances of Artemis launched within 8 seconds after shutdown UI - Updated About tab --- .../Services/Storage/ProfileService.cs | 7 +- .../Artemis.UI.Shared.csproj | 1 - src/Artemis.UI.Shared/packages.lock.json | 6 - src/Artemis.UI/ApplicationStateManager.cs | 17 +- src/Artemis.UI/Properties/launchSettings.json | 2 +- .../Dialogs/ProfileExportView.xaml | 69 ++- .../Dialogs/ProfileExportViewModel.cs | 18 +- .../Dialogs/LayerHintsDialogView.xaml | 175 +++---- .../Dialogs/LayerHintsDialogViewModel.cs | 13 + .../Settings/Tabs/About/AboutTabView.xaml | 446 ++++++++++++++++-- .../Settings/Tabs/About/AboutTabViewModel.cs | 11 + src/Artemis.UI/packages.lock.json | 8 +- 12 files changed, 586 insertions(+), 187 deletions(-) diff --git a/src/Artemis.Core/Services/Storage/ProfileService.cs b/src/Artemis.Core/Services/Storage/ProfileService.cs index 95b612d99..e75eec263 100644 --- a/src/Artemis.Core/Services/Storage/ProfileService.cs +++ b/src/Artemis.Core/Services/Storage/ProfileService.cs @@ -67,9 +67,12 @@ namespace Artemis.Core.Services foreach (ProfileModule profileModule in profileModules) { // Avoid race condition, make the check here - if (profileModule.ActiveProfile != null) + if (profileModule.ActiveProfile == null) + continue; + + profileModule.ActiveProfile.PopulateLeds(_rgbService.EnabledDevices); + if (profileModule.ActiveProfile.IsFreshImport) { - profileModule.ActiveProfile.PopulateLeds(_rgbService.EnabledDevices); _logger.Debug("Profile is a fresh import, adapting to surface - {profile}", profileModule.ActiveProfile); AdaptProfile(profileModule.ActiveProfile); } diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj index 893ff97d3..52563d5ef 100644 --- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj +++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj @@ -50,7 +50,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/src/Artemis.UI.Shared/packages.lock.json b/src/Artemis.UI.Shared/packages.lock.json index 27b93fa8d..88e8b3b52 100644 --- a/src/Artemis.UI.Shared/packages.lock.json +++ b/src/Artemis.UI.Shared/packages.lock.json @@ -113,12 +113,6 @@ "resolved": "0.4.0", "contentHash": "2Tzz6qoQNciyO4uT6wxByMiyvbve+u4eFIiDewDUbeHuxr/rKuba3/EhhXDsEH9WoKzYlpzqxDfQGPE/bIe5Rw==" }, - "WriteableBitmapEx": { - "type": "Direct", - "requested": "[1.6.7, )", - "resolved": "1.6.7", - "contentHash": "GoPhIdYzG/DWJq/MADb8gFzRN5PsxM+1DSJFS8Jzupg4DXqFSnlejYEjJw4ffPEUyELL07O4XIGUZydE4jQK0Q==" - }, "Castle.Core": { "type": "Transitive", "resolved": "4.2.0", diff --git a/src/Artemis.UI/ApplicationStateManager.cs b/src/Artemis.UI/ApplicationStateManager.cs index 1bc5d5c3a..2a08b4a3a 100644 --- a/src/Artemis.UI/ApplicationStateManager.cs +++ b/src/Artemis.UI/ApplicationStateManager.cs @@ -119,14 +119,17 @@ namespace Artemis.UI private void UtilitiesOnShutdownRequested(object sender, EventArgs e) { // Use PowerShell to kill the process after 8 sec just in case - ProcessStartInfo info = new() + if (!StartupArguments.Contains("--disable-forced-shutdown")) { - Arguments = "-Command \"& {Start-Sleep -s 8; (Get-Process 'Artemis.UI').kill()}", - WindowStyle = ProcessWindowStyle.Hidden, - CreateNoWindow = true, - FileName = "PowerShell.exe" - }; - Process.Start(info); + ProcessStartInfo info = new() + { + Arguments = "-Command \"& {Start-Sleep -s 8; (Get-Process -Id " + Process.GetCurrentProcess().Id + ").kill()}", + WindowStyle = ProcessWindowStyle.Hidden, + CreateNoWindow = true, + FileName = "PowerShell.exe" + }; + Process.Start(info); + } Execute.OnUIThread(() => Application.Current.Shutdown()); } diff --git a/src/Artemis.UI/Properties/launchSettings.json b/src/Artemis.UI/Properties/launchSettings.json index 1268340dc..ff7efa8ab 100644 --- a/src/Artemis.UI/Properties/launchSettings.json +++ b/src/Artemis.UI/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "Artemis.UI": { "commandName": "Project", - "commandLineArgs": "--force-elevation --pcmr" + "commandLineArgs": "--force-elevation --disable-forced-shutdown --pcmr" } } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Dialogs/ProfileExportView.xaml b/src/Artemis.UI/Screens/ProfileEditor/Dialogs/ProfileExportView.xaml index 7e67d06c8..4db9dc873 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Dialogs/ProfileExportView.xaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Dialogs/ProfileExportView.xaml @@ -4,44 +4,41 @@ 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" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> - - - - - - - - - Export current profile - + + + + + + + + Export current profile + - - Please note that exporting profiles like this is placeholder functionality. The idea is that this will eventually happen via the workshop. - + + It looks like you have not set up any profile adaption hints. This means Artemis can't do much to make your profile look good on a different surface other than try finding the same LEDs as you have. + + To configure adaption hints, right-click on a layer and choose View Adaption Hints. + + To learn more about profile adaption, check out + + this wiki article + . + - - The workshop will include tools to make profiles convert easily and look good on different layouts. - That means right now when someone imports this export unless they have the exact same setup as - you, they'll have to select LEDs for each layer in the profile. - - - - - - - + + + + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Dialogs/ProfileExportViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Dialogs/ProfileExportViewModel.cs index 7ab085f39..7b6758ee9 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Dialogs/ProfileExportViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Dialogs/ProfileExportViewModel.cs @@ -1,8 +1,8 @@ using System.Windows; +using System.Windows.Navigation; using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.Shared.Services; -using MaterialDesignThemes.Wpf; namespace Artemis.UI.Screens.ProfileEditor.Dialogs { @@ -21,6 +21,22 @@ namespace Artemis.UI.Screens.ProfileEditor.Dialogs public ProfileDescriptor ProfileDescriptor { get; } + #region Overrides of Screen + + /// + protected override void OnActivate() + { + // TODO: If the profile has hints on all layers, call Accept + base.OnActivate(); + } + + #endregion + + public void OpenHyperlink(object sender, RequestNavigateEventArgs e) + { + Core.Utilities.OpenUrl(e.Uri.AbsoluteUri); + } + public void Accept() { string encoded = _profileService.ExportProfile(ProfileDescriptor); diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/Dialogs/LayerHintsDialogView.xaml b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/Dialogs/LayerHintsDialogView.xaml index c20cb440c..2e82fc085 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/Dialogs/LayerHintsDialogView.xaml +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/Dialogs/LayerHintsDialogView.xaml @@ -22,91 +22,104 @@ d:DesignHeight="800" d:DesignWidth="800" d:DataContext="{d:DesignInstance dialogs:LayerHintsDialogViewModel}" Icon="/Resources/Images/Logo/bow.ico"> - - - - - + + + + + - - + + - - - - - - - + + + + + + + - - - - - - - - - - Introduction - - - In this window you can tell Artemis how this layer should be adapted when the profile is applied to a different set of devices by providing so-called adaption hints. - - When sharing your profile with other people good hints help them import your profile without the need for manual adjustments. - + + + + + + + + + + Introduction + + + In this window you can tell Artemis how this layer should be adapted when the profile is applied to a different set of devices by providing so-called adaption hints. + This is useful when sharing your profile with others, avoiding the need for manual adjustments. + + To learn more about profile adaption, check out + + this wiki article + + . + - - Adaption hints - - - - - - - - - - - - + + Adaption hints + + + + You haven't set up any adaption hints + Artemis will attempt to directly map the LEDs of this layer to different surfaces but results may vary. + + + + + + + + + + + + - - - - - - - + + + + + + + - - - + + - + + + + + PolyForm Noncommercial License 1.0.0 + + + + + + + + + + + + + + + + + + + + + + + Robert 'Spoinky' Beekman + + + Project owner, main contributor + + + + + + + + + + + + + + + + + + + + + + + + + Darth Affe + + + + RGB.NET + developer, main contributor + + + + + + + + + + + + + + + + + + + + + + + + + Diogo 'DrMeteor' Trindade + + + Main contributor + + + + + + + + + + + + + + + + + + + + + + + + + Kai Werling + + + Graphics design + + + + + + + + + + + + Special thanks + + + + - The various people creating PRs to Artemis.Plugins and the main repository + - All the people on Discord providing feedback and testing + + + + + + External libraries + + + + - Ben.Demystifier + + https://github.com/benaadams/Ben.Demystifier + + - EmbedIO + + https://unosquare.github.io/embedio/ + + - FluentValidation + + https://fluentvalidation.net/ + + - Furl.Http + + https://flurl.dev/ + + - gong-wpf-dragdrop + + https://github.com/punker76/gong-wpf-dragdrop + + - Hardcodet.NotifyIcon.Wpf.NetCore + + https://github.com/HavenDV/H.NotifyIcon.WPF + + - Humanizer + + https://github.com/Humanizr/Humanizer + + - LiteDB + + https://www.litedb.org/ + + - MaterialDesignThemes + + https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit + + - MaterialDesignExtensions + + https://spiegelp.github.io/MaterialDesignExtensions/ + + - McMaster.NETCore.Plugins + + https://github.com/natemcmaster/DotNetCorePlugins + + - Newtonsoft.Json + + https://www.newtonsoft.com/json + + - Ninject + + http://www.ninject.org/ + + - Ookii.Dialogs.Wpf + + https://github.com/ookii-dialogs/ookii-dialogs-wpf + + - RawInput.Sharp + + https://github.com/mfakane/rawinput-sharp + + - RGB.NET + + https://github.com/DarthAffe/RGB.NET + + - Serilog + + https://serilog.net/ + + - SkiaSharp + + https://github.com/mono/SkiaSharp + + - Stylet + + https://github.com/canton7/Stylet + + - Unclassified.NetRevisionTask + + https://unclassified.software/en/apps/netrevisiontask + + + + + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Tabs/About/AboutTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/About/AboutTabViewModel.cs index cbf2c00ae..0f03ebc7d 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/About/AboutTabViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/About/AboutTabViewModel.cs @@ -1,4 +1,5 @@ using System.Reflection; +using System.Windows.Navigation; using Artemis.Core; using Stylet; @@ -19,6 +20,16 @@ namespace Artemis.UI.Screens.Settings.Tabs.About set => SetAndNotify(ref _version, value); } + public void OpenHyperlink(object sender, RequestNavigateEventArgs e) + { + Core.Utilities.OpenUrl(e.Uri.AbsoluteUri); + } + + public void OpenUrl(string url) + { + Core.Utilities.OpenUrl(url); + } + #region Overrides of Screen /// diff --git a/src/Artemis.UI/packages.lock.json b/src/Artemis.UI/packages.lock.json index 9a607f014..6df570a98 100644 --- a/src/Artemis.UI/packages.lock.json +++ b/src/Artemis.UI/packages.lock.json @@ -1448,11 +1448,6 @@ "resolved": "3.0.0", "contentHash": "noPwJJl1Q9uparXy1ogtkmyAPGNfSGb0BLT1292nFH1jdMKje6o2kvvrQUvF9Xklj+IoiAI0UzF6Aqxlvo10lw==" }, - "WriteableBitmapEx": { - "type": "Transitive", - "resolved": "1.6.7", - "contentHash": "GoPhIdYzG/DWJq/MADb8gFzRN5PsxM+1DSJFS8Jzupg4DXqFSnlejYEjJw4ffPEUyELL07O4XIGUZydE4jQK0Q==" - }, "artemis.core": { "type": "Project", "dependencies": { @@ -1503,8 +1498,7 @@ "SkiaSharp.Views.WPF": "2.80.2", "Stylet": "1.3.6", "System.Buffers": "4.5.1", - "System.Numerics.Vectors": "4.5.0", - "WriteableBitmapEx": "1.6.7" + "System.Numerics.Vectors": "4.5.0" } } }