mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 08:56:15 +02:00
Add rotation setting to plugins
This commit is contained in:
@@ -241,13 +241,13 @@ 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");
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ public partial class PluginWindow : Window, IPluginWindow
|
|||||||
{
|
{
|
||||||
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>")
|
||||||
|
|||||||
@@ -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!;
|
||||||
|
|||||||
Reference in New Issue
Block a user