diff --git a/.gitignore b/.gitignore index a6d3a11..2c7bae1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ bin/ obj/ +# Project-specific files +/src/DesktopMagicPluginAPI/DesktopMagicPluginAPI.xml + # User-specific files *.rsuser *.suo diff --git a/README.md b/README.md index 9432b56..9e792d2 100644 --- a/README.md +++ b/README.md @@ -3,19 +3,23 @@ > You can add useful widgets to your desktop like a clock, an audio visualizer or even your own plugins using mod.io! - [Releases](https://github.com/Stone-Red-Code/DesktopMagic/releases) -- [Download plugins](https://mod.io/g/desktopmagic) +- [Browse plugins](https://mod.io/g/desktopmagic) - [Plugin creation guide](https://mod.io/g/desktopmagic/r/plugin-creation-guide) - [Licence](https://github.com/Stone-Red-Code/DesktopMagic/blob/main/LICENSE) -## Setup +## Usage -1. Download one of the [releases](https://github.com/Stone-Red-Code/DesktopMagic/releases). -1. Execute the `DesktopMagic-Installer.exe` file. -1. (Optional) Put a shortcut to the `DesktopMagic.exe` file in the install directory into the `shell:startup` directory. +1. Download & install the latest release + - Microsoft Store: [Store Page](https://www.microsoft.com/store/productId/9NPV8F9K1CWM?ocid=pdpshare) + - GitHub: [Releases](https://github.com/Stone-Red-Code/DesktopMagic/releases) +1. (Optional) Put a shortcut to the `DesktopMagic.exe` file in the installation directory into the `shell:startup` directory. +1. Start the app and select the widgets you want to see on your desktop. +1. Check the "Edit" Checkbox to move the widgets. +1. Open the plugin manager to install third-party plugins. ## Follow the development -[![Twitter(X)](http://img.shields.io/badge/Twitter-black.svg?&logo=x&style=for-the-badge&logoColor=white)](https://twitter.com/search?q=%23DesktopMagic%20%40StoneRedCode&f=live) +[![Twitter(X)](http://img.shields.io/badge/Twitter-black.svg?&logo=x&style=for-the-badge&logoColor=white)](https://x.com/search?q=from%3A%40StoneRedCode%20%23DesktopMagic) ## Preview @@ -23,8 +27,8 @@ ![Screenshot 2023-12-31 164853](https://github.com/Stone-Red-Code/DesktopMagic/assets/56473591/22de55d2-dde3-43a5-b77b-c773a7697e8c) ## Third party licenses + - [BusyIndicator](https://github.com/moh3ngolshani/BusyIndicator) - [MIT](https://github.com/Moh3nGolshani/BusyIndicator/blob/master/LICENSE) -- [Extended.Wpf.Toolkit](https://github.com/xceedsoftware/wpftoolkit) - [XCEED SOFTWARE COMMUNITY LICENSE AGREEMENT](https://github.com/xceedsoftware/wpftoolkit/blob/master/license.md) - [Material Design In XAML Toolkit](https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit) - [MIT](https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/LICENSE) -- [Modio.NET](https://github.com/thetestgame/modio.net) - [Apache-2.0](https://github.com/thetestgame/Modio.NET/blob/main/LICENSE-APACHE), [MIT](https://github.com/thetestgame/Modio.NET/blob/main/LICENSE-MIT) +- [Modio.NET](https://github.com/nickelc/modio.net) - [Apache-2.0](https://github.com/nickelc/modio.net/blob/master/LICENSE-APACHE), [MIT](https://github.com/nickelc/modio.net/blob/master/LICENSE-MIT) - [NAudio](https://github.com/naudio/NAudio) - [MIT](https://github.com/naudio/NAudio/blob/master/license.txt) diff --git a/installer/DesktopMagic-Installer.exe b/installer/DesktopMagic-Installer.exe index 279bb1a..d4b4ddc 100644 Binary files a/installer/DesktopMagic-Installer.exe and b/installer/DesktopMagic-Installer.exe differ diff --git a/src/DesktopMagic.sln b/src/DesktopMagic.sln index 3832c2c..bc4bd7a 100644 --- a/src/DesktopMagic.sln +++ b/src/DesktopMagic.sln @@ -9,24 +9,112 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopMagic.Api", "Desktop EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DesktopMagic.PluginTest", "DesktopMagicPlugin.Test\DesktopMagic.PluginTest.csproj", "{EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}" EndProject +Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "MsixPackaging", "MsixPackaging\MsixPackaging.wapproj", "{CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Release|Any CPU.Build.0 = Release|Any CPU + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Debug|Any CPU.ActiveCfg = Debug|x64 + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Debug|Any CPU.Build.0 = Debug|x64 + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Debug|ARM.ActiveCfg = Debug|Any CPU + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Debug|ARM.Build.0 = Debug|Any CPU + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Debug|ARM64.Build.0 = Debug|Any CPU + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Debug|x64.ActiveCfg = Debug|x64 + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Debug|x64.Build.0 = Debug|x64 + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Debug|x86.ActiveCfg = Debug|Any CPU + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Debug|x86.Build.0 = Debug|Any CPU + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Release|Any CPU.ActiveCfg = Release|x64 + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Release|Any CPU.Build.0 = Release|x64 + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Release|ARM.ActiveCfg = Release|Any CPU + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Release|ARM.Build.0 = Release|Any CPU + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Release|ARM64.ActiveCfg = Release|Any CPU + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Release|ARM64.Build.0 = Release|Any CPU + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Release|x64.ActiveCfg = Release|x64 + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Release|x64.Build.0 = Release|x64 + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Release|x86.ActiveCfg = Release|Any CPU + {B56B4CCC-CF92-4C05-9DEA-57666D81889A}.Release|x86.Build.0 = Release|Any CPU {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Debug|ARM.ActiveCfg = Debug|Any CPU + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Debug|ARM.Build.0 = Debug|Any CPU + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Debug|ARM64.Build.0 = Debug|Any CPU + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Debug|x64.ActiveCfg = Debug|x64 + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Debug|x64.Build.0 = Debug|x64 + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Debug|x86.ActiveCfg = Debug|Any CPU + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Debug|x86.Build.0 = Debug|Any CPU {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Release|Any CPU.ActiveCfg = Release|Any CPU {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Release|Any CPU.Build.0 = Release|Any CPU + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Release|ARM.ActiveCfg = Release|Any CPU + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Release|ARM.Build.0 = Release|Any CPU + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Release|ARM64.ActiveCfg = Release|Any CPU + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Release|ARM64.Build.0 = Release|Any CPU + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Release|x64.ActiveCfg = Release|x64 + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Release|x64.Build.0 = Release|x64 + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Release|x86.ActiveCfg = Release|Any CPU + {9D193A10-3E8E-447F-89F1-4B316C2EE37D}.Release|x86.Build.0 = Release|Any CPU {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Debug|ARM.ActiveCfg = Debug|Any CPU + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Debug|ARM.Build.0 = Debug|Any CPU + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Debug|ARM64.Build.0 = Debug|Any CPU + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Debug|x64.ActiveCfg = Debug|x64 + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Debug|x64.Build.0 = Debug|x64 + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Debug|x86.ActiveCfg = Debug|Any CPU + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Debug|x86.Build.0 = Debug|Any CPU {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Release|Any CPU.ActiveCfg = Release|Any CPU {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Release|Any CPU.Build.0 = Release|Any CPU + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Release|ARM.ActiveCfg = Release|Any CPU + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Release|ARM.Build.0 = Release|Any CPU + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Release|ARM64.ActiveCfg = Release|Any CPU + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Release|ARM64.Build.0 = Release|Any CPU + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Release|x64.ActiveCfg = Release|x64 + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Release|x64.Build.0 = Release|x64 + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Release|x86.ActiveCfg = Release|Any CPU + {EF8407AB-28AE-4B5E-AC2E-D4C4A575FBC7}.Release|x86.Build.0 = Release|Any CPU + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|ARM.ActiveCfg = Debug|ARM + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|ARM.Build.0 = Debug|ARM + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|ARM.Deploy.0 = Debug|ARM + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|ARM64.Build.0 = Debug|ARM64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|x64.ActiveCfg = Debug|x64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|x64.Build.0 = Debug|x64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|x64.Deploy.0 = Debug|x64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|x86.ActiveCfg = Debug|x86 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|x86.Build.0 = Debug|x86 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Debug|x86.Deploy.0 = Debug|x86 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|Any CPU.ActiveCfg = Release|x64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|Any CPU.Build.0 = Release|x64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|Any CPU.Deploy.0 = Release|x64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|ARM.ActiveCfg = Release|ARM + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|ARM.Build.0 = Release|ARM + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|ARM.Deploy.0 = Release|ARM + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|ARM64.ActiveCfg = Release|ARM64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|ARM64.Build.0 = Release|ARM64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|ARM64.Deploy.0 = Release|ARM64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|x64.ActiveCfg = Release|x64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|x64.Build.0 = Release|x64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|x64.Deploy.0 = Release|x64 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|x86.ActiveCfg = Release|x86 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|x86.Build.0 = Release|x86 + {CC2850EF-1451-4D0C-9474-4CBEBB28A2C8}.Release|x86.Deploy.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/DesktopMagic/App.xaml.cs b/src/DesktopMagic/App.xaml.cs index a4949bf..55be20b 100644 --- a/src/DesktopMagic/App.xaml.cs +++ b/src/DesktopMagic/App.xaml.cs @@ -14,13 +14,17 @@ public partial class App : Application { public const string AppGuid = "{{61FE5CE9-47C3-4255-A1F4-5BCF4ACA0879}"; - public const string AppName = "Desktop Magic"; + public const string AppName = "DesktopMagic"; + + // This is the previous name of the application, used to migrate the application data folder + private const string PreviousAppName = "Desktop Magic"; private static readonly string logFilePath = Path.Combine(ApplicationDataPath, $"{AppName}.log"); - private readonly Thread? eventThread; - private readonly EventWaitHandle eventWaitHandle; + public static string ApplicationDataPath => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "StoneRed", AppName); + + public static string PluginsPath => Path.Combine(ApplicationDataPath, "Plugins"); public static Logger Logger { get; } = new Logger() { @@ -62,33 +66,51 @@ public partial class App : Application } }; - public static string ApplicationDataPath => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "StoneRed", AppName); + public static ResourceDictionary LanguageDictionary + { + get + { + ResourceDictionary dict = []; + string currentCulture = Thread.CurrentThread.CurrentUICulture.ToString(); + + if (currentCulture.Contains("de")) + { + dict.Source = new Uri("..\\Resources\\Strings\\StringResources.de.xaml", UriKind.Relative); + } + else + { + dict.Source = new Uri("..\\Resources\\Strings\\StringResources.en.xaml", UriKind.Relative); + } + + return dict; + } + } + + private static string PreviousApplicationDataPath => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "StoneRed", PreviousAppName); public App() { // Setup global event handler eventWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, AppGuid, out bool createdNew); - //check if creating new was successful + // Check if creating new was successful if (!createdNew) { Setup(false); Logger.LogWarn("Shutting down because other instance already running.", source: "Setup"); - //Shutdown Application + // Shutdown Application _ = eventWaitHandle.Set(); Current.Shutdown(); } else { - eventThread = new Thread( - () => + eventThread = new Thread(() => + { + while (eventWaitHandle.WaitOne()) { - while (eventWaitHandle.WaitOne()) - { - _ = Current.Dispatcher.BeginInvoke( - () => ((MainWindow)Current.MainWindow).RestoreWindow()); - } - }); + _ = Current.Dispatcher.BeginInvoke(() => ((MainWindow)Current.MainWindow).RestoreWindow()); + } + }); eventThread.Start(); Setup(true); @@ -102,21 +124,39 @@ public partial class App : Application eventThread?.Interrupt(); } - private void Setup(bool clearLogFile) + private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + Exception exception = (Exception)e.ExceptionObject; + Logger.LogFatal(exception + (e.IsTerminating ? "\t Process terminating!" : ""), source: exception.Source ?? "Unknown"); + } + + private static void Setup(bool clearLogFile) { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; try { + if (Directory.Exists(PreviousApplicationDataPath) && !Directory.Exists(ApplicationDataPath)) + { + Directory.Move(PreviousApplicationDataPath, ApplicationDataPath); + Logger.LogInfo("Migrated ApplicationData folder", source: "Setup"); + } + if (!Directory.Exists(ApplicationDataPath)) { _ = Directory.CreateDirectory(ApplicationDataPath); + Logger.LogInfo("Created ApplicationData folder", source: "Setup"); + } + + if (!Directory.Exists(PluginsPath)) + { + _ = Directory.CreateDirectory(PluginsPath); + Logger.LogInfo("Created Plugins folder", source: "Setup"); } - Logger.LogInfo("Created ApplicationData Folder", source: "Main"); } catch (Exception ex) { - _ = MessageBox.Show(ex.ToString()); + _ = MessageBox.Show(ex.ToString(), AppName, MessageBoxButton.OK, MessageBoxImage.Error); Logger.Log(ex.Message, "Setup", LogSeverity.Error); } @@ -127,10 +167,4 @@ public partial class App : Application Logger.LogInfo("Setup complete", source: "Setup"); } - - private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) - { - Exception exception = (Exception)e.ExceptionObject; - Logger.LogFatal(exception + (e.IsTerminating ? "\t Process terminating!" : ""), source: exception.Source ?? "Unknown"); - } } \ No newline at end of file diff --git a/src/DesktopMagic/BuiltInWindowElements/CpuMonitorPlugin.cs b/src/DesktopMagic/BuiltInPlugins/CpuMonitorPlugin.cs similarity index 98% rename from src/DesktopMagic/BuiltInWindowElements/CpuMonitorPlugin.cs rename to src/DesktopMagic/BuiltInPlugins/CpuMonitorPlugin.cs index 7c8cca5..da4d02f 100644 --- a/src/DesktopMagic/BuiltInWindowElements/CpuMonitorPlugin.cs +++ b/src/DesktopMagic/BuiltInPlugins/CpuMonitorPlugin.cs @@ -7,7 +7,7 @@ using System.Drawing.Text; using SettingAttribute = DesktopMagic.Api.Settings.SettingAttribute; -namespace DesktopMagic.BuiltInWindowElements; +namespace DesktopMagic.BuiltInPlugins; internal class CpuMonitorPlugin : Plugin { diff --git a/src/DesktopMagic/BuiltInWindowElements/DatePlugin.cs b/src/DesktopMagic/BuiltInPlugins/DatePlugin.cs similarity index 80% rename from src/DesktopMagic/BuiltInWindowElements/DatePlugin.cs rename to src/DesktopMagic/BuiltInPlugins/DatePlugin.cs index 00190d0..9a6ad36 100644 --- a/src/DesktopMagic/BuiltInWindowElements/DatePlugin.cs +++ b/src/DesktopMagic/BuiltInPlugins/DatePlugin.cs @@ -5,22 +5,22 @@ using System; using System.Drawing; using System.Drawing.Text; -namespace DesktopMagic.BuiltInWindowElements; +namespace DesktopMagic.BuiltInPlugins; internal class DatePlugin : Plugin { [Setting("short-date", "Short date")] - private readonly CheckBox shortDatecheckBox = new CheckBox(true); + private readonly CheckBox shortDateCheckBox = new CheckBox(true); private DateTime oldDateTime = DateTime.MinValue; private Color oldColor = Color.White; private string oldFont = string.Empty; - private bool oldShortDatecheckBoxValue; + private bool oldShortDateCheckBoxValue; public override int UpdateInterval => 1000; public override Bitmap? Main() { - if (oldDateTime.Date == DateTime.Now.Date && oldColor == Application.Theme.PrimaryColor && oldFont == Application.Theme.Font && oldShortDatecheckBoxValue == shortDatecheckBox.Value) + if (oldDateTime.Date == DateTime.Now.Date && oldColor == Application.Theme.PrimaryColor && oldFont == Application.Theme.Font && oldShortDateCheckBoxValue == shortDateCheckBox.Value) { return null; } @@ -28,9 +28,9 @@ internal class DatePlugin : Plugin oldDateTime = DateTime.Now; oldColor = Application.Theme.PrimaryColor; oldFont = Application.Theme.Font; - oldShortDatecheckBoxValue = shortDatecheckBox.Value; + oldShortDateCheckBoxValue = shortDateCheckBox.Value; - string date = shortDatecheckBox.Value ? DateTime.Now.ToShortDateString() : DateTime.Now.ToLongDateString(); + string date = shortDateCheckBox.Value ? DateTime.Now.ToShortDateString() : DateTime.Now.ToLongDateString(); Font font = new Font(Application.Theme.Font, 200); diff --git a/src/DesktopMagic/BuiltInWindowElements/MusicVisualizerPlugin.cs b/src/DesktopMagic/BuiltInPlugins/MusicVisualizerPlugin.cs similarity index 99% rename from src/DesktopMagic/BuiltInWindowElements/MusicVisualizerPlugin.cs rename to src/DesktopMagic/BuiltInPlugins/MusicVisualizerPlugin.cs index 50eb70a..cbea875 100644 --- a/src/DesktopMagic/BuiltInWindowElements/MusicVisualizerPlugin.cs +++ b/src/DesktopMagic/BuiltInPlugins/MusicVisualizerPlugin.cs @@ -9,7 +9,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; -namespace DesktopMagic.BuiltInWindowElements; +namespace DesktopMagic.BuiltInPlugins; internal class MusicVisualizerPlugin : Plugin { diff --git a/src/DesktopMagic/BuiltInWindowElements/TimePlugin.cs b/src/DesktopMagic/BuiltInPlugins/TimePlugin.cs similarity index 59% rename from src/DesktopMagic/BuiltInWindowElements/TimePlugin.cs rename to src/DesktopMagic/BuiltInPlugins/TimePlugin.cs index b25d73c..f56d699 100644 --- a/src/DesktopMagic/BuiltInWindowElements/TimePlugin.cs +++ b/src/DesktopMagic/BuiltInPlugins/TimePlugin.cs @@ -5,19 +5,33 @@ using System; using System.Drawing; using System.Drawing.Text; -namespace DesktopMagic.BuiltInWindowElements; +namespace DesktopMagic.BuiltInPlugins; internal class TimePlugin : Plugin { - [Setting("display-seconds", "Display Seconds")] + [Setting("display-seconds", "Show Seconds")] private readonly CheckBox displaySecondsCheckBox = new CheckBox(true); + private string oldTime = string.Empty; + private Color oldColor = Color.White; + private string oldFont = string.Empty; + private bool oldDisplaySecondsCheckBoxValue; public override int UpdateInterval => 1000; - public override Bitmap Main() + public override Bitmap? Main() { string time = displaySecondsCheckBox.Value ? DateTime.Now.ToLongTimeString() : DateTime.Now.ToShortTimeString(); + if (oldTime == time && oldColor == Application.Theme.PrimaryColor && oldFont == Application.Theme.Font && oldDisplaySecondsCheckBoxValue == displaySecondsCheckBox.Value) + { + return null; + } + + oldTime = time; + oldColor = Application.Theme.PrimaryColor; + oldFont = Application.Theme.Font; + oldDisplaySecondsCheckBoxValue = displaySecondsCheckBox.Value; + Font font = new Font(Application.Theme.Font, 200); Bitmap bmp = new Bitmap(1, 1); diff --git a/src/DesktopMagic/DataContexts/MainWindowDataContext.cs b/src/DesktopMagic/DataContexts/MainWindowDataContext.cs index 725f55f..183d23b 100644 --- a/src/DesktopMagic/DataContexts/MainWindowDataContext.cs +++ b/src/DesktopMagic/DataContexts/MainWindowDataContext.cs @@ -1,4 +1,5 @@ -using DesktopMagic.Settings; +using DesktopMagic.Helpers; +using DesktopMagic.Settings; using System.ComponentModel; using System.Runtime.CompilerServices; @@ -32,6 +33,23 @@ internal class MainWindowDataContext : INotifyPropertyChanged } } + public bool IsAutoStartEnabled + { + get => StartupManager.IsAutoStartEnabled(); + set + { + if (value) + { + _ = StartupManager.EnableAutoStart(); + } + else + { + _ = StartupManager.DisableAutoStart(); + } + OnPropertyChanged(); + } + } + public static DesktopMagicSettings GetSettings() { return settings; diff --git a/src/DesktopMagic/DataContexts/PluginEntryDataContext.cs b/src/DesktopMagic/DataContexts/PluginEntryDataContext.cs index 66401c7..c13876f 100644 --- a/src/DesktopMagic/DataContexts/PluginEntryDataContext.cs +++ b/src/DesktopMagic/DataContexts/PluginEntryDataContext.cs @@ -1,14 +1,18 @@ -using DesktopMagic.Plugins; +using DesktopMagic.Helpers; +using DesktopMagic.Plugins; + +using MaterialDesignThemes.Wpf; using System; using System.ComponentModel; +using System.Diagnostics; using System.Runtime.CompilerServices; using System.Windows; using System.Windows.Input; namespace DesktopMagic.DataContexts; -internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand command, bool installed = false) : INotifyPropertyChanged +internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand command, PluginEntryDataContext.Mode mode, string? path = null) : INotifyPropertyChanged { public event PropertyChangedEventHandler? PropertyChanged; @@ -18,18 +22,38 @@ internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand co public string? Description => pluginMetadata.Description; + public string Author => pluginMetadata.Author ?? (string)App.LanguageDictionary["unknown"]; + + public string? Version => pluginMetadata.Version ?? (string)App.LanguageDictionary["unknown"]; + public string? Logo => pluginMetadata.IconUri?.ToString(); - public DateTime? FormattedDateAdded => pluginMetadata.Added; - public DateTime? FormattedDateUpdated => pluginMetadata.Updated; + public DateTime? DateAdded => pluginMetadata.Added; + public DateTime? DateUpdated => pluginMetadata.Updated; public uint Id => pluginMetadata.Id; + public string? Path => path; + + public bool IsLocalPlugin => string.IsNullOrWhiteSpace(pluginMetadata.ProfileUri?.ToString()); public ICommand Command => command; - public Visibility InstallButtonVisibility => installed ? Visibility.Collapsed : Visibility.Visible; + public ButtonData InstallUninstallButtonData => new(mode == Mode.Install ? PackIconKind.Download : PackIconKind.Remove, GetInstallUninstallButtonText(), true, Command); - public Visibility RemoveButtonVisibility => installed ? Visibility.Visible : Visibility.Collapsed; + public ButtonData OpenButtonData + { + get + { + if (string.IsNullOrWhiteSpace(pluginMetadata.ProfileUri?.ToString())) + { + return new(PackIconKind.FolderOutline, (string)App.LanguageDictionary["folder"], path is not null, new CommandHandler(() => Process.Start("explorer.exe", path!))); + } + else + { + return new(PackIconKind.ExternalLink, "mod.io", true, new CommandHandler(OpenModIoPage)); + } + } + } public bool IsVisible { @@ -44,8 +68,37 @@ internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand co public Visibility Visibility => IsVisible ? Visibility.Visible : Visibility.Collapsed; + private void OpenModIoPage() + { + ProcessStartInfo psi = new ProcessStartInfo + { + UseShellExecute = true, + FileName = pluginMetadata.ProfileUri?.ToString() ?? path + }; + + _ = Process.Start(psi); + } + + private string GetInstallUninstallButtonText() + { + return mode switch + { + Mode.Install => (string)App.LanguageDictionary["install"], + Mode.Uninstall => (string)App.LanguageDictionary["uninstall"], + _ => throw new NotImplementedException() + }; + } + private void OnPropertyChanged([CallerMemberName] string? propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } + + public record ButtonData(PackIconKind IconKind, string Text, bool IsEnabled, ICommand Command); + + public enum Mode + { + Install, + Uninstall + } } \ No newline at end of file diff --git a/src/DesktopMagic/DataContexts/PluginManagerDataContext.cs b/src/DesktopMagic/DataContexts/PluginManagerDataContext.cs index ac1cdfb..b1ca54f 100644 --- a/src/DesktopMagic/DataContexts/PluginManagerDataContext.cs +++ b/src/DesktopMagic/DataContexts/PluginManagerDataContext.cs @@ -12,6 +12,7 @@ internal class PluginManagerDataContext : INotifyPropertyChanged private string installedPluginsSearchText = string.Empty; private bool isLoading = true; private bool isSearching; + private bool isAuthenticated = false; public ObservableCollection AllPlugins { get; } = []; public ObservableCollection InstalledPlugins { get; } = []; @@ -58,6 +59,19 @@ internal class PluginManagerDataContext : INotifyPropertyChanged } } + public bool IsAuthenticated + { + get => isAuthenticated; + set + { + isAuthenticated = value; + OnPropertyChanged(); + OnPropertyChanged(nameof(LoginButtonText)); + } + } + + public string LoginButtonText => isAuthenticated ? (string)App.LanguageDictionary["logout"] : (string)App.LanguageDictionary["login"]; + protected void OnPropertyChanged([CallerMemberName] string? name = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); diff --git a/src/DesktopMagic/DesktopMagic.csproj b/src/DesktopMagic/DesktopMagic.csproj index ed6c720..6f82e04 100644 --- a/src/DesktopMagic/DesktopMagic.csproj +++ b/src/DesktopMagic/DesktopMagic.csproj @@ -7,20 +7,26 @@ icon.ico OnBuildSuccess Stone_Red - 1.0.1.240501 + 1.1.0.0 https://github.com/Stone-Red-Code/DesktopMagic https://github.com/Stone-Red-Code/DesktopMagic - 1.0.1.0501 - 1.0.1.0501 + 1.1.0.0 + 1.1.0.0 net8.0-windows7.0 + win-x64 enable false + AnyCPU;x64 DEBUG;TRACE + + DEBUG;TRACE + + @@ -38,9 +44,9 @@ - - - + + + @@ -58,4 +64,10 @@ + + + + PreserveNewest + + \ No newline at end of file diff --git a/src/DesktopMagic/Dialogs/ColorDialog.xaml b/src/DesktopMagic/Dialogs/ColorDialog.xaml index abd2ee2..18c4330 100644 --- a/src/DesktopMagic/Dialogs/ColorDialog.xaml +++ b/src/DesktopMagic/Dialogs/ColorDialog.xaml @@ -8,10 +8,11 @@ mc:Ignorable="d" ResizeMode="NoResize" Title="ColorDialog" + WindowStartupLocation="CenterOwner" SizeToContent="WidthAndHeight"> - - + - + - + diff --git a/src/DesktopMagic/MainWindow.xaml.cs b/src/DesktopMagic/MainWindow.xaml.cs index 85df4d1..fb861ca 100644 --- a/src/DesktopMagic/MainWindow.xaml.cs +++ b/src/DesktopMagic/MainWindow.xaml.cs @@ -1,4 +1,4 @@ -using DesktopMagic.BuiltInWindowElements; +using DesktopMagic.BuiltInPlugins; using DesktopMagic.DataContexts; using DesktopMagic.Dialogs; using DesktopMagic.Helpers; @@ -9,12 +9,9 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.IO.Packaging; using System.Linq; -using System.Reflection; using System.Text.Json; using System.Threading; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Media; @@ -29,17 +26,16 @@ namespace DesktopMagic private readonly Dictionary builtInPlugins = new() { - {new("Music Visualizer", 1), typeof(MusicVisualizerPlugin)}, - {new("Time",2), typeof(TimePlugin)}, - {new("Date",3), typeof(DatePlugin)}, - {new("Cpu Usage", 4), typeof(CpuMonitorPlugin)} + {new((string)App.LanguageDictionary["musicVisualizer"], 1), typeof(MusicVisualizerPlugin)}, + {new((string)App.LanguageDictionary["time"],2), typeof(TimePlugin)}, + {new((string)App.LanguageDictionary["date"],3), typeof(DatePlugin)}, + {new((string)App.LanguageDictionary["cpuUsage"], 4), typeof(CpuMonitorPlugin)} }; private bool loaded = false; private bool blockWindowsClosing = true; public static List Windows { get; } = []; public static List WindowNames { get; } = []; - internal static bool EditMode { get; set; } = false; private DesktopMagicSettings Settings { @@ -54,14 +50,25 @@ namespace DesktopMagic try { Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/DesktopMagic;component/icon.ico")).Stream; - notifyIcon.Click += TaskbarIcon_TrayLeftClick; + notifyIcon.MouseClick += NotifyIcon_MouseClick; notifyIcon.Visible = true; notifyIcon.Text = App.AppName; notifyIcon.Icon = new System.Drawing.Icon(iconStream); + notifyIcon.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip() + { + Items = + { + new System.Windows.Forms.ToolStripMenuItem((string)App.LanguageDictionary["open"], null, (s, e) => RestoreWindow()), + new System.Windows.Forms.ToolStripMenuItem((string)App.LanguageDictionary["toggleEditMode"], null, (s, e) => { editCheckBox.IsChecked = !editCheckBox.IsChecked; EditCheckBox_Click(null, null); }), + new System.Windows.Forms.ToolStripMenuItem((string)App.LanguageDictionary["pluginManager"], null, (s, e) => PluginManagerButton_Click(null!, null!)), + new System.Windows.Forms.ToolStripMenuItem("GitHub", null, (s, e) => GitHubButton_Click(null!, null!)), + new System.Windows.Forms.ToolStripMenuItem((string)App.LanguageDictionary["quit"], null, (s, e) => Quit()), + } + }; InitializeComponent(); - SetLanguageDictionary(); + Resources.MergedDictionaries.Add(App.LanguageDictionary); #if DEBUG Title = $"{App.AppName} - Dev {System.Windows.Forms.Application.ProductVersion}"; @@ -71,7 +78,7 @@ namespace DesktopMagic } catch (Exception ex) { - _ = MessageBox.Show(ex.ToString()); + _ = MessageBox.Show(ex.ToString(), App.AppName, MessageBoxButton.OK, MessageBoxImage.Error); } } @@ -83,12 +90,6 @@ namespace DesktopMagic { try { - if (!Directory.Exists(App.ApplicationDataPath + "\\Plugins")) - { - _ = Directory.CreateDirectory(App.ApplicationDataPath + "\\Plugins"); - } - App.Logger.LogInfo("Created Plugins Folder", source: "Main"); - //Write To Log File and Load Elements App.Logger.LogInfo("Loading Plugin names", source: "Main"); @@ -104,7 +105,7 @@ namespace DesktopMagic catch (Exception ex) { App.Logger.LogError(ex.Message, source: "Main"); - _ = MessageBox.Show(ex.ToString()); + _ = MessageBox.Show(ex.ToString(), App.AppName, MessageBoxButton.OK, MessageBoxImage.Error); } } @@ -118,9 +119,7 @@ namespace DesktopMagic plugins.Add(buildInPlugin.Id, new(buildInPlugin, string.Empty)); } - string pluginsPath = App.ApplicationDataPath + "\\Plugins"; - - foreach (string directory in Directory.GetDirectories(pluginsPath)) + foreach (string directory in Directory.GetDirectories(App.PluginsPath)) { string? pluginDllPath = Directory.GetFiles(directory, "main.dll").FirstOrDefault(); string? pluginMetadataPath = Directory.GetFiles(directory, "metadata.json").FirstOrDefault(); @@ -162,7 +161,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(); } @@ -242,31 +245,26 @@ namespace DesktopMagic window.PluginLoaded -= onPluginLoaded; }); }; + window.OnExit += () => { + Windows.Remove(window); + WindowNames.Remove(window.Title); + blockWindowsClosing = false; + window.Close(); + blockWindowsClosing = true; pluginSettings.Enabled = false; }; window.PluginLoaded += onPluginLoaded; window.ShowInTaskbar = false; window.Show(); - window.ContentRendered += DisplayWindow_ContentRendered; + window.SetEditMode(editCheckBox.IsChecked == true); window.Closing += DisplayWindow_Closing; Windows.Add(window); WindowNames.Add(window.Title); } - private void DisplayWindow_ContentRendered(object? sender, EventArgs e) - { - if (sender is not Window window) - { - return; - } - - WindowPos.SendWpfWindowBack(window); - WindowPos.SendWpfWindowBack(window); - } - private void DisplayWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = blockWindowsClosing; @@ -274,9 +272,18 @@ namespace DesktopMagic private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { - MessageBoxResult msbRes = MessageBox.Show((string)FindResource("wantToCloseProgram"), App.AppName, MessageBoxButton.YesNo); - e.Cancel = msbRes != MessageBoxResult.Yes; SaveSettings(); + + if (blockWindowsClosing) + { + e.Cancel = true; + + editCheckBox.IsChecked = false; + EditCheckBox_Click(null, null); + ShowInTaskbar = false; + WindowState = WindowState.Minimized; + Visibility = Visibility.Collapsed; + } } private void Window_Closed(object sender, EventArgs e) @@ -290,22 +297,6 @@ namespace DesktopMagic Environment.Exit(0); } - private void Window_StateChanged(object? sender, EventArgs? e) - { - if (WindowState == WindowState.Minimized) - { - EditCheckBox.IsChecked = false; - EditCheckBox_Click(null, null); - ShowInTaskbar = false; - Visibility = Visibility.Collapsed; - foreach (Window item in Windows) - { - WindowPos.SendWpfWindowBack(item); - WindowPos.SendWpfWindowBack(item); - } - } - } - #endregion Windows #region Options @@ -372,6 +363,24 @@ namespace DesktopMagic } } + private void Quit() + { + blockWindowsClosing = false; + Close(); + } + + private void OpenPluginsFolderButton_Click(object sender, RoutedEventArgs e) + { + _ = Process.Start("explorer.exe", App.PluginsPath); + } + + private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e) + { + ScrollViewer scv = (ScrollViewer)sender; + scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); + e.Handled = true; + } + private void TextBlock_Loaded(object sender, RoutedEventArgs e) { int index = 0; @@ -398,7 +407,11 @@ namespace DesktopMagic private void ChangePrimaryColorButton_Click(object sender, RoutedEventArgs e) { - ColorDialog colorDialog = new ColorDialog("Set Primary Color", Settings.CurrentLayout.Theme.PrimaryColor); + ColorDialog colorDialog = new ColorDialog("Set Primary Color", Settings.CurrentLayout.Theme.PrimaryColor) + { + Owner = this + }; + if (colorDialog.ShowDialog() == true) { Settings.CurrentLayout.Theme.PrimaryColor = colorDialog.ResultColor; @@ -408,7 +421,11 @@ namespace DesktopMagic private void ChangeSecondaryColorButton_Click(object sender, RoutedEventArgs e) { - ColorDialog colorDialog = new ColorDialog("Set Secondary Color", Settings.CurrentLayout.Theme.SecondaryColor); + ColorDialog colorDialog = new ColorDialog("Set Secondary Color", Settings.CurrentLayout.Theme.SecondaryColor) + { + Owner = this + }; + if (colorDialog.ShowDialog() == true) { Settings.CurrentLayout.Theme.SecondaryColor = colorDialog.ResultColor; @@ -418,7 +435,11 @@ namespace DesktopMagic private void ChangeBackgroundColorButton_Click(object sender, RoutedEventArgs e) { - ColorDialog colorDialog = new ColorDialog("Set Background Color", Settings.CurrentLayout.Theme.BackgroundColor); + ColorDialog colorDialog = new ColorDialog("Set Background Color", Settings.CurrentLayout.Theme.BackgroundColor) + { + Owner = this + }; + if (colorDialog.ShowDialog() == true) { Settings.CurrentLayout.Theme.BackgroundColor = colorDialog.ResultColor; @@ -475,12 +496,16 @@ namespace DesktopMagic private void NewLayoutButton_Click(object sender, RoutedEventArgs e) { - InputDialog inputDialog = new((string)FindResource("enterLayoutName")); + InputDialog inputDialog = new((string)FindResource("enterLayoutName")) + { + Owner = this + }; + if (inputDialog.ShowDialog() == true) { if (Settings.Layouts.Any(l => l.Name.Trim() == inputDialog.ResponseText.Trim())) { - _ = MessageBox.Show((string)FindResource("layoutAlreadyExists")); + _ = MessageBox.Show((string)FindResource("layoutAlreadyExists"), App.AppName, MessageBoxButton.OK, MessageBoxImage.Warning); return; } @@ -552,8 +577,8 @@ namespace DesktopMagic window.Close(); } - EditCheckBox.IsChecked = false; - EditMode = false; + editCheckBox.IsChecked = false; + EditCheckBox_Click(null, null); blockWindowsClosing = true; Windows.Clear(); WindowNames.Clear(); @@ -600,14 +625,13 @@ namespace DesktopMagic if (!showWindow && minimize) { - WindowState = WindowState.Minimized; - Window_StateChanged(null, null); + Close(); } else { - WindowState = WindowState.Normal; - Window_StateChanged(null, null); + RestoreWindow(); } + mainWindowDataContext.IsLoading = false; } @@ -619,21 +643,12 @@ namespace DesktopMagic LoadLayout(false); } - private void OpenPluginsFolderButton_Click(object sender, RoutedEventArgs e) + private void NotifyIcon_MouseClick(object? sender, System.Windows.Forms.MouseEventArgs e) { - _ = Process.Start("explorer.exe", App.ApplicationDataPath + "\\Plugins"); - } - - private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e) - { - ScrollViewer scv = (ScrollViewer)sender; - scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta); - e.Handled = true; - } - - private void TaskbarIcon_TrayLeftClick(object? sender, EventArgs e) - { - RestoreWindow(); + if (e.Button == System.Windows.Forms.MouseButtons.Left) + { + RestoreWindow(); + } } private void GitHubButton_Click(object sender, RoutedEventArgs e) @@ -649,26 +664,14 @@ namespace DesktopMagic private void PluginManagerButton_Click(object sender, RoutedEventArgs e) { - PluginManager pluginManager = new PluginManager(); + PluginManager pluginManager = new PluginManager + { + Owner = this + }; + pluginManager.ShowDialog(); LoadPlugins(); - LoadLayout(false); - } - - private void SetLanguageDictionary() - { - ResourceDictionary dict = []; - string currentCulture = Thread.CurrentThread.CurrentUICulture.ToString(); - - if (currentCulture.Contains("de")) - { - dict.Source = new Uri("..\\Resources\\Strings\\StringResources.de.xaml", UriKind.Relative); - } - else - { - dict.Source = new Uri("..\\Resources\\Strings\\StringResources.en.xaml", UriKind.Relative); - } - Resources.MergedDictionaries.Add(dict); + LoadLayout(Visibility != Visibility.Visible); } } diff --git a/src/DesktopMagic/Plugins/ModEntry.xaml b/src/DesktopMagic/Plugins/ModEntry.xaml deleted file mode 100644 index 820c8b9..0000000 --- a/src/DesktopMagic/Plugins/ModEntry.xaml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - + + + + + \ No newline at end of file diff --git a/src/DesktopMagic/Plugins/ModEntry.xaml.cs b/src/DesktopMagic/Plugins/PluginEntry.xaml.cs similarity index 99% rename from src/DesktopMagic/Plugins/ModEntry.xaml.cs rename to src/DesktopMagic/Plugins/PluginEntry.xaml.cs index 1d29732..f136bbb 100644 --- a/src/DesktopMagic/Plugins/ModEntry.xaml.cs +++ b/src/DesktopMagic/Plugins/PluginEntry.xaml.cs @@ -1,6 +1,7 @@ using System.Windows.Controls; namespace DesktopMagic.Plugins; + /// /// Interaction logic for ModEntry.xaml /// @@ -10,4 +11,4 @@ public partial class ModEntry : UserControl { InitializeComponent(); } -} +} \ No newline at end of file diff --git a/src/DesktopMagic/Plugins/PluginManager.xaml b/src/DesktopMagic/Plugins/PluginManager.xaml index 49a64dd..8031cac 100644 --- a/src/DesktopMagic/Plugins/PluginManager.xaml +++ b/src/DesktopMagic/Plugins/PluginManager.xaml @@ -9,7 +9,7 @@ xmlns:dataContexts="clr-namespace:DesktopMagic.DataContexts" mc:Ignorable="d" d:DataContext="{d:DesignInstance Type=dataContexts:PluginManagerDataContext}" - Title="PluginManager" + Title="{DynamicResource pluginManager}" Height="450" Width="800" MinHeight="520" @@ -31,7 +31,7 @@ -