From 0fb0c4d4e8f6d5aa4f47b69e92cf240b17718f7c Mon Sep 17 00:00:00 2001 From: Zach Date: Sun, 1 Jan 2023 21:13:04 -0500 Subject: [PATCH] Updated preset/process/parameter UI Added button to toggle map filters Added delete confirmation to presets --- .../Configuration/ConfigurationManager.cs | 22 +- CompilePalX/MainWindow.xaml | 213 ++++++++++++++++-- CompilePalX/MainWindow.xaml.cs | 145 +++++++++--- CompilePalX/PresetDialog.xaml | 2 +- CompilePalX/PresetDialog.xaml.cs | 24 +- 5 files changed, 341 insertions(+), 65 deletions(-) diff --git a/CompilePalX/Configuration/ConfigurationManager.cs b/CompilePalX/Configuration/ConfigurationManager.cs index 2b493ab7..edc0d1a7 100644 --- a/CompilePalX/Configuration/ConfigurationManager.cs +++ b/CompilePalX/Configuration/ConfigurationManager.cs @@ -16,7 +16,7 @@ namespace CompilePalX { - public class Preset : IEquatable + public class Preset : IEquatable, ICloneable { public string Name { get; set; } public string? Map { get; set; } @@ -41,6 +41,10 @@ public override int GetHashCode() { return HashCode.Combine(Name, MapRegex, Map); } + public object Clone() + { + return this.MemberwiseClone(); + } /// /// Returns whether a map can use the preset @@ -284,6 +288,22 @@ public static Preset NewPreset(Preset preset) return preset; } + public static Preset? EditPreset(Preset preset) + { + if (CurrentPreset == null) + { + return null; + } + + // "Edit" preset by deleting the current preset and adding a new preset, then make it the currently selected preset + RemovePreset(CurrentPreset); + var newPreset = NewPreset(preset); + + CurrentPreset = newPreset; + + return newPreset; + } + private static string GetPresetFolder(Preset preset) { return preset.Map != null ? Path.Combine(PresetsFolder, $"{preset.Name}_{preset.Map}") : Path.Combine(PresetsFolder, preset.Name); diff --git a/CompilePalX/MainWindow.xaml b/CompilePalX/MainWindow.xaml index 4e605021..d43c58e8 100644 --- a/CompilePalX/MainWindow.xaml +++ b/CompilePalX/MainWindow.xaml @@ -7,10 +7,13 @@ xmlns:config="clr-namespace:CompilePalX.Configuration" xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks" xmlns:compilePalX="clr-namespace:CompilePalX" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + Name="CompileWindow" + Title="Compile Pal X" - MinHeight="550" MinWidth="790" - Height="550" Width="790" + MinHeight="595" MinWidth="850" + Height="595" Width="850" Closing="MetroWindow_Closing" IconEdgeMode="Aliased" Icon="CompilePalIcon.ico" ShowIconOnTitleBar="False" Activated="MetroWindow_Activated" @@ -56,7 +59,7 @@ - + @@ -80,25 +83,179 @@ - - + + - - + + + + + + Preset + - + + + + + + + + + + + + + - + @@ -112,10 +269,17 @@ - + - + + Process + @@ -168,10 +332,20 @@ - + - + + Parameters + + + + + @@ -230,7 +404,6 @@ - @@ -317,12 +490,6 @@ - - - -