From c021f7ee244102f706fa0e6f21aa4e3973187f3c Mon Sep 17 00:00:00 2001 From: Daniel Triendl Date: Mon, 7 Apr 2025 09:12:52 +0200 Subject: [PATCH] Profile settings --- proxmox-spice-launcher.sln | 12 ++--- .../{proxmox-spice-launcher => }/App.xaml | 0 .../{proxmox-spice-launcher => }/App.xaml.cs | 0 .../AssemblyInfo.cs | 0 .../{proxmox-spice-launcher => }/DPApi.cs | 0 .../ObservableCollectionExtensions.cs | 16 ++++++ .../MainWindow.xaml | 28 ++++++---- .../MainWindow.xaml.cs | 31 +++++------ src/proxmox-spice-launcher/Models/Settings.cs | 50 ++++++++++++++++++ .../Proxmox.SpiceLauncher.png | Bin .../SettingsWindow.xaml | 26 +++++++++ .../SettingsWindow.xaml.cs | 50 ++++++++++++++++++ .../proxmox-spice-launcher.csproj | 0 .../proxmox-spice-launcher/Models/Settings.cs | 37 ------------- 14 files changed, 179 insertions(+), 71 deletions(-) rename src/proxmox-spice-launcher/{proxmox-spice-launcher => }/App.xaml (100%) rename src/proxmox-spice-launcher/{proxmox-spice-launcher => }/App.xaml.cs (100%) rename src/proxmox-spice-launcher/{proxmox-spice-launcher => }/AssemblyInfo.cs (100%) rename src/proxmox-spice-launcher/{proxmox-spice-launcher => }/DPApi.cs (100%) create mode 100644 src/proxmox-spice-launcher/Extensions/ObservableCollectionExtensions.cs rename src/proxmox-spice-launcher/{proxmox-spice-launcher => }/MainWindow.xaml (61%) rename src/proxmox-spice-launcher/{proxmox-spice-launcher => }/MainWindow.xaml.cs (86%) create mode 100644 src/proxmox-spice-launcher/Models/Settings.cs rename src/proxmox-spice-launcher/{proxmox-spice-launcher => }/Proxmox.SpiceLauncher.png (100%) create mode 100644 src/proxmox-spice-launcher/SettingsWindow.xaml create mode 100644 src/proxmox-spice-launcher/SettingsWindow.xaml.cs rename src/proxmox-spice-launcher/{proxmox-spice-launcher => }/proxmox-spice-launcher.csproj (100%) delete mode 100644 src/proxmox-spice-launcher/proxmox-spice-launcher/Models/Settings.cs diff --git a/proxmox-spice-launcher.sln b/proxmox-spice-launcher.sln index c622efa..abb7794 100644 --- a/proxmox-spice-launcher.sln +++ b/proxmox-spice-launcher.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.13.35919.96 d17.13 +VisualStudioVersion = 17.13.35919.96 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "proxmox-spice-launcher", "src\proxmox-spice-launcher\proxmox-spice-launcher\proxmox-spice-launcher.csproj", "{9A4EC4BE-8920-461F-8653-A9650A68B727}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "proxmox-spice-launcher", "src\proxmox-spice-launcher\proxmox-spice-launcher.csproj", "{8F3740FC-DC36-1459-2ECB-B04F0BBA4ED8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9A4EC4BE-8920-461F-8653-A9650A68B727}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A4EC4BE-8920-461F-8653-A9650A68B727}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9A4EC4BE-8920-461F-8653-A9650A68B727}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9A4EC4BE-8920-461F-8653-A9650A68B727}.Release|Any CPU.Build.0 = Release|Any CPU + {8F3740FC-DC36-1459-2ECB-B04F0BBA4ED8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8F3740FC-DC36-1459-2ECB-B04F0BBA4ED8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F3740FC-DC36-1459-2ECB-B04F0BBA4ED8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8F3740FC-DC36-1459-2ECB-B04F0BBA4ED8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/proxmox-spice-launcher/proxmox-spice-launcher/App.xaml b/src/proxmox-spice-launcher/App.xaml similarity index 100% rename from src/proxmox-spice-launcher/proxmox-spice-launcher/App.xaml rename to src/proxmox-spice-launcher/App.xaml diff --git a/src/proxmox-spice-launcher/proxmox-spice-launcher/App.xaml.cs b/src/proxmox-spice-launcher/App.xaml.cs similarity index 100% rename from src/proxmox-spice-launcher/proxmox-spice-launcher/App.xaml.cs rename to src/proxmox-spice-launcher/App.xaml.cs diff --git a/src/proxmox-spice-launcher/proxmox-spice-launcher/AssemblyInfo.cs b/src/proxmox-spice-launcher/AssemblyInfo.cs similarity index 100% rename from src/proxmox-spice-launcher/proxmox-spice-launcher/AssemblyInfo.cs rename to src/proxmox-spice-launcher/AssemblyInfo.cs diff --git a/src/proxmox-spice-launcher/proxmox-spice-launcher/DPApi.cs b/src/proxmox-spice-launcher/DPApi.cs similarity index 100% rename from src/proxmox-spice-launcher/proxmox-spice-launcher/DPApi.cs rename to src/proxmox-spice-launcher/DPApi.cs diff --git a/src/proxmox-spice-launcher/Extensions/ObservableCollectionExtensions.cs b/src/proxmox-spice-launcher/Extensions/ObservableCollectionExtensions.cs new file mode 100644 index 0000000..3705521 --- /dev/null +++ b/src/proxmox-spice-launcher/Extensions/ObservableCollectionExtensions.cs @@ -0,0 +1,16 @@ +using System.Collections.ObjectModel; + +namespace Proxmox.SpiceLauncher.Extensions; +internal static class ObservableCollectionExtensions +{ + public static ObservableCollection Sort(this ObservableCollection collection, Comparison comparison) + { + var sortableList = new List(collection); + sortableList.Sort(comparison); + for (int i = 0; i < sortableList.Count; i++) + { + collection.Move(collection.IndexOf(sortableList[i]), i); + } + return collection; + } +} diff --git a/src/proxmox-spice-launcher/proxmox-spice-launcher/MainWindow.xaml b/src/proxmox-spice-launcher/MainWindow.xaml similarity index 61% rename from src/proxmox-spice-launcher/proxmox-spice-launcher/MainWindow.xaml rename to src/proxmox-spice-launcher/MainWindow.xaml index 181d274..7bca720 100644 --- a/src/proxmox-spice-launcher/proxmox-spice-launcher/MainWindow.xaml +++ b/src/proxmox-spice-launcher/MainWindow.xaml @@ -7,7 +7,7 @@ xmlns:local="clr-namespace:Proxmox.SpiceLauncher" xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks" mc:Ignorable="d" - Title="Proxmox Spice Launcher" Height="391" Width="350" ResizeMode="NoResize" + Title="Proxmox Spice Launcher" Height="391" Width="539" ResizeMode="NoResize" Initialized="MetroWindow_Initialized" Closing="MetroWindow_Closing" SizeToContent="Height" Icon="pack://application:,,,/Proxmox.SpiceLauncher.png"> @@ -29,18 +29,24 @@ - - - - + + + + + +