diff --git a/installer/DesktopMagic-Installer.exe b/installer/DesktopMagic-Installer.exe
index 279bb1a..449358a 100644
Binary files a/installer/DesktopMagic-Installer.exe and b/installer/DesktopMagic-Installer.exe differ
diff --git a/src/DesktopMagic/App.xaml.cs b/src/DesktopMagic/App.xaml.cs
index 3a3366a..599b3df 100644
--- a/src/DesktopMagic/App.xaml.cs
+++ b/src/DesktopMagic/App.xaml.cs
@@ -98,6 +98,23 @@ public partial class App : Application
}
}
+ public static ResourceDictionary GetLanguageDictionary()
+ {
+ 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;
+ }
+
protected void CloseHandler(object sender, EventArgs e)
{
eventWaitHandle.Close();
diff --git a/src/DesktopMagic/DataContexts/PluginEntryDataContext.cs b/src/DesktopMagic/DataContexts/PluginEntryDataContext.cs
index 51edbbb..500dda1 100644
--- a/src/DesktopMagic/DataContexts/PluginEntryDataContext.cs
+++ b/src/DesktopMagic/DataContexts/PluginEntryDataContext.cs
@@ -12,7 +12,7 @@ using System.Windows.Input;
namespace DesktopMagic.DataContexts;
-internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand command, string? buttonText = "") : INotifyPropertyChanged
+internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand command, PluginEntryDataContext.Mode mode, string? path = null) : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
@@ -22,9 +22,9 @@ internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand co
public string? Description => pluginMetadata.Description;
- public string Author => pluginMetadata.Author ?? "Unknown";
+ public string Author => pluginMetadata.Author ?? (string)App.GetLanguageDictionary()["unknown"];
- public string? Version => pluginMetadata.Version ?? "Unknown";
+ public string? Version => pluginMetadata.Version ?? (string)App.GetLanguageDictionary()["unknown"];
public string? Logo => pluginMetadata.IconUri?.ToString();
@@ -33,15 +33,24 @@ internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand co
public uint Id => pluginMetadata.Id;
- public string? ButtonText => buttonText;
-
public ICommand Command => command;
- public ButtonData InstallUninstallButtonData => new(ButtonText ?? "Install", true, Command);
- public ButtonData OpenModioButtonData => new("modio", true, new CommandHandler(OpenModioPage));
+ public ButtonData InstallUninstallButtonData => new(mode == Mode.Install ? PackIconKind.Download : PackIconKind.Remove, GetInstallUninstallButtonText(), true, Command);
-
- public Visibility ButtonVisibility => string.IsNullOrWhiteSpace(buttonText) ? Visibility.Collapsed : Visibility.Visible;
+ public ButtonData OpenButtonData
+ {
+ get
+ {
+ if (string.IsNullOrWhiteSpace(pluginMetadata.ProfileUri?.ToString()))
+ {
+ return new(PackIconKind.FolderOutline, (string)App.GetLanguageDictionary()["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
{
@@ -53,7 +62,6 @@ internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand co
OnPropertyChanged(nameof(Visibility));
}
}
- public MaterialDesignThemes.Wpf.PackIconKind IconKind => MaterialDesignThemes.Wpf.PackIconKind.Information;
public Visibility Visibility => IsVisible ? Visibility.Visible : Visibility.Collapsed;
@@ -62,16 +70,32 @@ internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand co
ProcessStartInfo psi = new ProcessStartInfo
{
UseShellExecute = true,
- FileName = pluginMetadata.ProfileUri?.ToString()
+ FileName = pluginMetadata.ProfileUri?.ToString() ?? path
};
_ = Process.Start(psi);
}
+ private string GetInstallUninstallButtonText()
+ {
+ return mode switch
+ {
+ Mode.Install => (string)App.GetLanguageDictionary()["install"],
+ Mode.Uninstall => (string)App.GetLanguageDictionary()["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/Dialogs/ColorDialog.xaml.cs b/src/DesktopMagic/Dialogs/ColorDialog.xaml.cs
index 0d92c20..3a141bc 100644
--- a/src/DesktopMagic/Dialogs/ColorDialog.xaml.cs
+++ b/src/DesktopMagic/Dialogs/ColorDialog.xaml.cs
@@ -1,7 +1,5 @@
using DesktopMagic.Helpers;
-using System;
-using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
@@ -17,12 +15,14 @@ public partial class ColorDialog : Window
public Brush ResultBrush { get; private set; } = Brushes.Transparent;
- public ColorDialog(string content, System.Drawing.Color defaultColor, string title = "ColorDialog")
+ public ColorDialog(string content, System.Drawing.Color defaultColor, string title = App.AppName)
{
InitializeComponent();
+
+ Resources.MergedDictionaries.Add(App.GetLanguageDictionary());
+
label.Content = content;
Title = title;
- SetLanguageDictionary();
alphaSlider.Value = defaultColor.A;
redSlider.Value = defaultColor.R;
@@ -108,20 +108,4 @@ public partial class ColorDialog : Window
colorHexTextBox.Text += ((int)redSlider.Value).ToString("X2") + ((int)greenSlider.Value).ToString("X2") + ((int)blueSlider.Value).ToString("X2");
}
-
- private void SetLanguageDictionary()
- {
- ResourceDictionary dict = [];
- string currentCulture = Thread.CurrentThread.CurrentCulture.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);
- }
}
\ No newline at end of file
diff --git a/src/DesktopMagic/Dialogs/InputDialog.xaml.cs b/src/DesktopMagic/Dialogs/InputDialog.xaml.cs
index 216afd1..bafad17 100644
--- a/src/DesktopMagic/Dialogs/InputDialog.xaml.cs
+++ b/src/DesktopMagic/Dialogs/InputDialog.xaml.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Threading;
-using System.Windows;
+using System.Windows;
namespace DesktopMagic.Dialogs;
@@ -12,12 +10,14 @@ public partial class InputDialog : Window
set => textBox.Text = value;
}
- public InputDialog(string content, string title = "InputDialog")
+ public InputDialog(string content, string title = App.AppName)
{
InitializeComponent();
+
+ Resources.MergedDictionaries.Add(App.GetLanguageDictionary());
+
label.Content = content;
Title = title;
- SetLanguageDictionary();
}
private void OkButton_Click(object sender, RoutedEventArgs e)
@@ -29,20 +29,4 @@ public partial class InputDialog : Window
{
DialogResult = false;
}
-
- private void SetLanguageDictionary()
- {
- ResourceDictionary dict = [];
- string currentCulture = Thread.CurrentThread.CurrentCulture.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);
- }
}
\ No newline at end of file
diff --git a/src/DesktopMagic/MainWindow.xaml b/src/DesktopMagic/MainWindow.xaml
index 3833e3e..ee979da 100644
--- a/src/DesktopMagic/MainWindow.xaml
+++ b/src/DesktopMagic/MainWindow.xaml
@@ -133,16 +133,46 @@
-
-
+
+
-
-
+
+
-
-
+
+
diff --git a/src/DesktopMagic/MainWindow.xaml.cs b/src/DesktopMagic/MainWindow.xaml.cs
index 6ec808d..6b41b14 100644
--- a/src/DesktopMagic/MainWindow.xaml.cs
+++ b/src/DesktopMagic/MainWindow.xaml.cs
@@ -26,10 +26,10 @@ 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.GetLanguageDictionary()["musicVisualizer"], 1), typeof(MusicVisualizerPlugin)},
+ {new((string)App.GetLanguageDictionary()["time"],2), typeof(TimePlugin)},
+ {new((string)App.GetLanguageDictionary()["date"],3), typeof(DatePlugin)},
+ {new((string)App.GetLanguageDictionary()["cpuUsage"], 4), typeof(CpuMonitorPlugin)}
};
private bool loaded = false;
@@ -58,17 +58,17 @@ namespace DesktopMagic
{
Items =
{
- new System.Windows.Forms.ToolStripMenuItem("Open", null, (s, e) => RestoreWindow()),
- new System.Windows.Forms.ToolStripMenuItem("Toggle Edit Mode", null, (s, e) => { EditCheckBox.IsChecked = !EditCheckBox.IsChecked; EditCheckBox_Click(null, null); }),
- new System.Windows.Forms.ToolStripMenuItem("Plugin Manager", null, (s, e) => PluginManagerButton_Click(null!, null!)),
+ new System.Windows.Forms.ToolStripMenuItem((string)App.GetLanguageDictionary()["open"], null, (s, e) => RestoreWindow()),
+ new System.Windows.Forms.ToolStripMenuItem((string)App.GetLanguageDictionary()["toggleEditMode"], null, (s, e) => { EditCheckBox.IsChecked = !EditCheckBox.IsChecked; EditCheckBox_Click(null, null); }),
+ new System.Windows.Forms.ToolStripMenuItem((string)App.GetLanguageDictionary()["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("Quit", null, (s, e) => Quit()),
+ new System.Windows.Forms.ToolStripMenuItem((string)App.GetLanguageDictionary()["quit"], null, (s, e) => Quit()),
}
};
InitializeComponent();
- SetLanguageDictionary();
+ Resources.MergedDictionaries.Add(App.GetLanguageDictionary());
#if DEBUG
Title = $"{App.AppName} - Dev {System.Windows.Forms.Application.ProductVersion}";
@@ -664,22 +664,6 @@ namespace DesktopMagic
LoadPlugins();
LoadLayout(Visibility != Visibility.Visible);
}
-
- 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);
- }
}
internal class InternalPluginData(PluginMetadata pluginMetadata, string directoryPath)
diff --git a/src/DesktopMagic/Plugins/ModEntry.xaml b/src/DesktopMagic/Plugins/ModEntry.xaml
index bb4f653..d29b84a 100644
--- a/src/DesktopMagic/Plugins/ModEntry.xaml
+++ b/src/DesktopMagic/Plugins/ModEntry.xaml
@@ -29,10 +29,10 @@
-
-
-
-
+
+
+
+
@@ -41,16 +41,16 @@
-
diff --git a/src/DesktopMagic/Plugins/ModEntry.xaml.cs b/src/DesktopMagic/Plugins/ModEntry.xaml.cs
index 1d29732..f136bbb 100644
--- a/src/DesktopMagic/Plugins/ModEntry.xaml.cs
+++ b/src/DesktopMagic/Plugins/ModEntry.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 f517ded..d2834b5 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="Plugin Manager"
+ Title="{DynamicResource pluginManager}"
Height="450"
Width="800"
MinHeight="520"
@@ -31,7 +31,7 @@
-
+
@@ -64,7 +64,7 @@
-
+
diff --git a/src/DesktopMagic/Plugins/PluginManager.xaml.cs b/src/DesktopMagic/Plugins/PluginManager.xaml.cs
index 64cf929..8672ee5 100644
--- a/src/DesktopMagic/Plugins/PluginManager.xaml.cs
+++ b/src/DesktopMagic/Plugins/PluginManager.xaml.cs
@@ -44,6 +44,8 @@ public partial class PluginManager : Window
{
InitializeComponent();
+ Resources.MergedDictionaries.Add(App.GetLanguageDictionary());
+
DataContext = pluginManagerDataContext;
searchTimer.Tick += async (sender, e) =>
{
@@ -97,7 +99,7 @@ public partial class PluginManager : Window
if (pluginMetadata is not null)
{
- pluginManagerDataContext.InstalledPlugins.Add(new PluginEntryDataContext(pluginMetadata, new CommandHandler(() => Remove(pluginPath, pluginMetadata.Id)), "Uninstall"));
+ pluginManagerDataContext.InstalledPlugins.Add(new PluginEntryDataContext(pluginMetadata, new CommandHandler(() => Remove(pluginPath, pluginMetadata.Id)), PluginEntryDataContext.Mode.Uninstall, pluginPath));
_ = pluginIds.Add(pluginMetadata.Id);
}
}
@@ -112,7 +114,7 @@ public partial class PluginManager : Window
continue;
}
- pluginManagerDataContext.AllPlugins.Add(new PluginEntryDataContext(new(mod), new CommandHandler(async () => await Install(mod)), "Install"));
+ pluginManagerDataContext.AllPlugins.Add(new PluginEntryDataContext(new(mod), new CommandHandler(async () => await Install(mod)), PluginEntryDataContext.Mode.Install));
}
pluginManagerDataContext.IsLoading = false;
@@ -168,7 +170,7 @@ public partial class PluginManager : Window
_ = pluginManagerDataContext.AllPlugins.Remove(pluginEntryDataContext);
}
- pluginManagerDataContext.InstalledPlugins.Add(new PluginEntryDataContext(new PluginMetadata(mod), new CommandHandler(() => Remove(pluginPath, mod.Id)), "Uninstall"));
+ pluginManagerDataContext.InstalledPlugins.Add(new PluginEntryDataContext(new PluginMetadata(mod), new CommandHandler(() => Remove(pluginPath, mod.Id)), PluginEntryDataContext.Mode.Uninstall));
pluginManagerDataContext.IsLoading = false;
}
@@ -228,7 +230,7 @@ public partial class PluginManager : Window
continue;
}
- pluginManagerDataContext.AllPlugins.Add(new PluginEntryDataContext(new(mod), new CommandHandler(async () => await Install(mod)), "Install"));
+ pluginManagerDataContext.AllPlugins.Add(new PluginEntryDataContext(new(mod), new CommandHandler(async () => await Install(mod)), PluginEntryDataContext.Mode.Install));
}
pluginManagerDataContext.IsSearching = false;
diff --git a/src/DesktopMagic/Resources/Strings/StringResources.de.xaml b/src/DesktopMagic/Resources/Strings/StringResources.de.xaml
index af92866..786fdde 100644
--- a/src/DesktopMagic/Resources/Strings/StringResources.de.xaml
+++ b/src/DesktopMagic/Resources/Strings/StringResources.de.xaml
@@ -5,9 +5,16 @@
Linie
Spiegeln
+ Ordner
+ Unbekannt
+ Öffnen
+ Schließen
+ Bearbeitungsmodus umschalten
+ Alle Plugins
+ Installierte Plugins
Neu Laden
- Plugins Ordner Öffnen
- Plugin Manager
+ Plugins Ordner
+ Plugins Manager
Farbe:
Standard
Wollen sie das Programm wirklich schließen?
@@ -16,9 +23,7 @@
Uhrzeit
Datum
CPU Auslastung
- Google Kalender
- Musik Visualizer
- Musik Visualizer Einstellungen:
+ Musik Visualisierer
Signalverstärkung:
Neues Layout
Layout Löschen
@@ -27,7 +32,12 @@
Layoutnamen eingeben:
Layout existiert bereits!
Installieren
+ Deinstallieren
Entfernen
+ Author: {0}
+ Erstellt: {0}
+ Aktualisiert: {0}
+ Version: {0}
Unten
Mitte
diff --git a/src/DesktopMagic/Resources/Strings/StringResources.en.xaml b/src/DesktopMagic/Resources/Strings/StringResources.en.xaml
index 04bb3e8..fa6d822 100644
--- a/src/DesktopMagic/Resources/Strings/StringResources.en.xaml
+++ b/src/DesktopMagic/Resources/Strings/StringResources.en.xaml
@@ -5,9 +5,16 @@
Line
Mirror
+ Folder
+ Unknown
+ Open
+ Quit
+ Toggle Edit Mode
+ All Plugins
+ Installed Plugins
Reload
- Open Plugins Folder
- Plugin Manager
+ Plugins Folder
+ Plugins Manager
Color:
Default
Do you really want to close the program?
@@ -16,9 +23,7 @@
Time
Date
CPU Usage
- Google Calendar
Music Visualizer
- Music Visualizer Options:
Signal Amplification:
New Layout
Delete Layout
@@ -27,7 +32,12 @@
Enter layout name
Layout already exists!
Install
+ Uninstall
Remove
+ Author: {0}
+ Added: {0}
+ Updated: {0}
+ Version: {0}
Bottom
Middle