Improve plugin window performance by not constantly updating properties of UI elements

This commit is contained in:
Stone_Red
2024-11-29 17:55:33 +01:00
parent 35d64ef2c3
commit f8f06a9e2c
3 changed files with 65 additions and 65 deletions
+6 -3
View File
@@ -39,7 +39,6 @@ namespace DesktopMagic
private bool blockWindowsClosing = true;
public static List<PluginWindow> Windows { get; } = [];
public static List<string> WindowNames { get; } = [];
internal static bool EditMode { get; set; } = false;
private DesktopMagicSettings Settings
{
@@ -173,7 +172,11 @@ namespace DesktopMagic
private void EditCheckBox_Click(object? sender, RoutedEventArgs? e)
{
EditMode = EditCheckBox.IsChecked == true;
foreach (PluginWindow window in Windows)
{
window.SetEditMode(EditCheckBox.IsChecked == true);
}
SaveSettings();
}
@@ -261,6 +264,7 @@ namespace DesktopMagic
window.ShowInTaskbar = false;
window.Show();
window.SetEditMode(EditCheckBox.IsChecked == true);
window.ContentRendered += DisplayWindow_ContentRendered;
window.Closing += DisplayWindow_Closing;
Windows.Add(window);
@@ -565,7 +569,6 @@ namespace DesktopMagic
}
EditCheckBox.IsChecked = false;
EditMode = false;
blockWindowsClosing = true;
Windows.Clear();
WindowNames.Clear();