Add confirmation when deleting themes/layouts

This commit is contained in:
Stone_Red
2025-12-20 16:17:45 +01:00
parent a8fe2c80f1
commit 9a96c60af0
3 changed files with 19 additions and 1 deletions
+13 -1
View File
@@ -28,7 +28,7 @@ namespace DesktopMagic
{new((string)App.LanguageDictionary["time"],2), typeof(TimePlugin)},
{new((string)App.LanguageDictionary["date"],3), typeof(DatePlugin)},
{new((string)App.LanguageDictionary["cpuUsage"], 4), typeof(CpuMonitorPlugin)},
{new("Weather", 5), typeof(WeatherPlugin)},
{new((string)App.LanguageDictionary["weather"], 5), typeof(WeatherPlugin)},
};
private bool loaded = false;
@@ -329,6 +329,12 @@ namespace DesktopMagic
return;
}
MessageBoxResult result = MessageBox.Show((string)FindResource("confirmDeleteTheme"), App.AppName, MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result != MessageBoxResult.Yes)
{
return;
}
Settings.Themes.Remove((Theme)themesListBox.SelectedItem);
SaveSettings();
}
@@ -468,6 +474,12 @@ namespace DesktopMagic
return;
}
MessageBoxResult result = MessageBox.Show((string)FindResource("confirmDeleteLayout"), App.AppName, MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result != MessageBoxResult.Yes)
{
return;
}
Settings.Layouts.Remove(Settings.CurrentLayout);
SaveSettings();
}
@@ -31,6 +31,7 @@
<system:String x:Key="date">Datum</system:String>
<system:String x:Key="cpuUsage">CPU Auslastung</system:String>
<system:String x:Key="musicVisualizer">Musik Visualisierer</system:String>
<system:String x:Key="weather">Wetter</system:String>
<system:String x:Key="amplifier">Signalverstärkung:</system:String>
<system:String x:Key="newLayout">Neues Layout</system:String>
<system:String x:Key="deleteLayout">Layout Löschen</system:String>
@@ -39,6 +40,8 @@
<system:String x:Key="changeTheme">Theme Ändern</system:String>
<system:String x:Key="ok">Ok</system:String>
<system:String x:Key="cancel">Abbrechen</system:String>
<system:String x:Key="confirmDeleteLayout">Möchten Sie dieses Layout wirklich löschen?</system:String>
<system:String x:Key="confirmDeleteTheme">Möchten Sie dieses Theme wirklich löschen?</system:String>
<system:String x:Key="enterLayoutName">Layoutnamen eingeben:</system:String>
<system:String x:Key="layoutAlreadyExists">Layout existiert bereits!</system:String>
<system:String x:Key="enterThemeName">Themenamen eingeben:</system:String>
@@ -31,6 +31,7 @@
<system:String x:Key="date">Date</system:String>
<system:String x:Key="cpuUsage">CPU Usage</system:String>
<system:String x:Key="musicVisualizer">Music Visualizer</system:String>
<system:String x:Key="weather">Weather</system:String>
<system:String x:Key="amplifier">Signal Amplification:</system:String>
<system:String x:Key="newLayout">New Layout</system:String>
<system:String x:Key="deleteLayout">Delete Layout</system:String>
@@ -39,6 +40,8 @@
<system:String x:Key="changeTheme">Change Theme</system:String>
<system:String x:Key="ok">Ok</system:String>
<system:String x:Key="cancel">Cancel</system:String>
<system:String x:Key="confirmDeleteLayout">Do you really want to delete this layout?</system:String>
<system:String x:Key="confirmDeleteTheme">Do you really want to delete this theme?</system:String>
<system:String x:Key="enterLayoutName">Enter layout name</system:String>
<system:String x:Key="layoutAlreadyExists">Layout already exists!</system:String>
<system:String x:Key="cannotDeleteLastLayout">Can't delete last layout!</system:String>