Add rotation setting to plugins

This commit is contained in:
Stone_Red
2026-01-23 20:35:15 +01:00
parent 4133f61a5c
commit 2853d49dd9
2 changed files with 15 additions and 5 deletions
+11 -4
View File
@@ -241,21 +241,21 @@ public partial class PluginWindow : Window, IPluginWindow
assemblyLoadContext = CreateAssemblyLoadContext(); assemblyLoadContext = CreateAssemblyLoadContext();
// Show busy indicator // Show busy indicator
await Dispatcher.InvokeAsync(() => busyMask.IsBusy = true); _ = await Dispatcher.InvokeAsync(() => busyMask.IsBusy = true);
// Reload the plugin // Reload the plugin
await ExecuteSource(); await ExecuteSource();
// Hide busy indicator // Hide busy indicator
await Dispatcher.InvokeAsync(() => busyMask.IsBusy = false); _ = await Dispatcher.InvokeAsync(() => busyMask.IsBusy = false);
App.Logger.LogInfo($"\"{PluginMetadata.Name}\" - Plugin reloaded successfully", source: "Plugin"); App.Logger.LogInfo($"\"{PluginMetadata.Name}\" - Plugin reloaded successfully", source: "Plugin");
} }
catch (Exception ex) catch (Exception ex)
{ {
App.Logger.LogError($"\"{PluginMetadata.Name}\" - Failed to reload plugin: {ex}", source: "Plugin"); App.Logger.LogError($"\"{PluginMetadata.Name}\" - Failed to reload plugin: {ex}", source: "Plugin");
await Dispatcher.InvokeAsync(async () => _ = await Dispatcher.InvokeAsync(async () =>
{ {
Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox Wpf.Ui.Controls.MessageBox messageBox = new Wpf.Ui.Controls.MessageBox
{ {
@@ -525,11 +525,13 @@ public partial class PluginWindow : Window, IPluginWindow
{ {
SetHorizontalAlignment(); SetHorizontalAlignment();
SetVerticalAlignment(); SetVerticalAlignment();
SetRotation();
SetThemeOverride(); SetThemeOverride();
SetThemeOverrideItems(); SetThemeOverrideItems();
pluginClassInstance.horizontalAlignment.OnValueChanged += SetHorizontalAlignment; pluginClassInstance.horizontalAlignment.OnValueChanged += SetHorizontalAlignment;
pluginClassInstance.verticalAlignment.OnValueChanged += SetVerticalAlignment; pluginClassInstance.verticalAlignment.OnValueChanged += SetVerticalAlignment;
pluginClassInstance.rotation.OnValueChanged += SetRotation;
pluginClassInstance.themeOverride.OnValueChanged += SetThemeOverride; pluginClassInstance.themeOverride.OnValueChanged += SetThemeOverride;
DesktopMagicSettings desktopMagicSettings = MainWindowDataContext.GetSettings(); DesktopMagicSettings desktopMagicSettings = MainWindowDataContext.GetSettings();
@@ -564,6 +566,11 @@ public partial class PluginWindow : Window, IPluginWindow
border.HorizontalAlignment = horizontalAlignment; border.HorizontalAlignment = horizontalAlignment;
} }
void SetRotation()
{
image.LayoutTransform = new RotateTransform(pluginClassInstance.rotation.Value);
}
void SetThemeOverride() void SetThemeOverride()
{ {
if (pluginClassInstance.themeOverride.Value == "<None>") if (pluginClassInstance.themeOverride.Value == "<None>")
+4 -1
View File
@@ -23,7 +23,10 @@ public abstract class Plugin
[Setting("desktopmagic-vertical-alignment", "Vertical Alignment", -998)] [Setting("desktopmagic-vertical-alignment", "Vertical Alignment", -998)]
internal ComboBox verticalAlignment = new ComboBox("Center", "Top", "Bottom"); internal ComboBox verticalAlignment = new ComboBox("Center", "Top", "Bottom");
[Setting("theme-override", "Theme Override", -997)] [Setting("rotation", "Rotation", -997)]
internal IntegerUpDown rotation = new IntegerUpDown(-360, 360, 0);
[Setting("theme-override", "Theme Override", -996)]
internal ComboBox themeOverride = new ComboBox("<None>"); internal ComboBox themeOverride = new ComboBox("<None>");
private IPluginData application = null!; private IPluginData application = null!;