diff --git a/CargoMonitor/ConfigurationWindow.xaml b/CargoMonitor/ConfigurationWindow.xaml index 465ee0398a..9d1e6aa968 100644 --- a/CargoMonitor/ConfigurationWindow.xaml +++ b/CargoMonitor/ConfigurationWindow.xaml @@ -1,4 +1,4 @@ - - - - - + + + + + + - @@ -31,7 +33,7 @@ - @@ -44,7 +46,7 @@ - @@ -57,7 +59,7 @@ - @@ -70,7 +72,7 @@ - @@ -83,7 +85,7 @@ - @@ -96,7 +98,7 @@ - diff --git a/ChangeLog.md b/ChangeLog.md index d8afd59200..f1249949aa 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,6 +7,7 @@ Full details of the variables available for each noted event, and VoiceAttack in * Installer revised to more gracefully handle installation over an existing installation of EDDI 4.1.9 or earlier (e.g. when installing VoiceAttack 2 over an existing VoiceAttack 1 installation). * Various bug fixes from telemetry. * Speech Responder + * Fixed the active personality ComboBox layout in the Speech Responder tab so the dropdown arrow doesn't overlap the personality name text. * Fixed copied personalities not being editable until EDDI is restarted. * Fixed failing lexicon schema validation (for .pls lexicon files). (#2814) (thanks to @klightspeed) * Fix `StopSpeaking()` function from creating unexpected "paused" speech outputs when used in a script which enqueues new speech. (#2815) diff --git a/CommanderMonitor/ConfigurationWindow.xaml b/CommanderMonitor/ConfigurationWindow.xaml index d7537b977a..c3a1a43d4b 100644 --- a/CommanderMonitor/ConfigurationWindow.xaml +++ b/CommanderMonitor/ConfigurationWindow.xaml @@ -1,4 +1,4 @@ - - - + + @@ -36,8 +36,8 @@ - - + + @@ -71,7 +71,7 @@ - @@ -30,7 +30,7 @@ - @@ -43,7 +43,7 @@ - @@ -56,7 +56,7 @@ - @@ -69,7 +69,7 @@ - @@ -82,7 +82,7 @@ - diff --git a/Directory.Build.targets b/Directory.Build.targets index a663293550..cd7a7b603b 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,8 +1,8 @@ - + - + @@ -12,7 +12,7 @@ - + diff --git a/EDDI/App.xaml b/EDDI/App.xaml index 4924b2219d..983a6f0bef 100644 --- a/EDDI/App.xaml +++ b/EDDI/App.xaml @@ -1,6 +1,12 @@ - + + + + + + diff --git a/EDDI/App.xaml.cs b/EDDI/App.xaml.cs index f222aa250e..43aef2b4cd 100644 --- a/EDDI/App.xaml.cs +++ b/EDDI/App.xaml.cs @@ -60,6 +60,7 @@ public static void Main ( string[] args = null ) } var app = new App(); + app.InitializeComponent(); app.Exit += OnExit; try @@ -106,6 +107,9 @@ private static System.Version ParseVoiceAttackVersion( string[] args ) private static void Initialize ( App app, bool fromVA = false, System.Version vaVersion = null, EDDIConfiguration configuration = null ) { + // Initialize our dynamic theme management engine + EddiUI.Themes.ThemeManager.Initialize(); + // Prepare to start the application if ( configuration != null && !configuration.DisableTelemetry ) { @@ -187,6 +191,7 @@ private static void OnExit(object sender, ExitEventArgs e) // Always stop the EDDI instance so monitors and services are shut down // cleanly before the process exits. EDDI.Instance.Stop(); + ConfigService.Instance.Dispose(); Current?.Dispatcher?.InvokeAsync( () => { eddiMutex.ReleaseMutex(); diff --git a/EDDI/ThemeService.cs b/EDDI/ThemeService.cs new file mode 100644 index 0000000000..6dae024b6e --- /dev/null +++ b/EDDI/ThemeService.cs @@ -0,0 +1,34 @@ +using System; +using System.Linq; +using System.Windows; + +namespace Eddi +{ + public static class ThemeService + { + private static readonly Uri DarkThemeUri = new Uri("/EDDI;component/Themes/DarkTheme.xaml", UriKind.Relative); + + public static void ApplyTheme() + { + Application.Current.Dispatcher.Invoke(() => + { + var dictionaries = Application.Current.Resources.MergedDictionaries; + var existing = dictionaries.FirstOrDefault(d => d.Source != null && d.Source.OriginalString.Contains("DarkTheme.xaml")); + if (existing != null) + { + dictionaries.Remove(existing); + } + + try + { + var rd = new ResourceDictionary() { Source = DarkThemeUri }; + dictionaries.Add(rd); + } + catch (Exception) + { + // Swallow - fail safe to existing resources + } + }); + } + } +} diff --git a/EDDI/Themes/DarkTheme.xaml b/EDDI/Themes/DarkTheme.xaml new file mode 100644 index 0000000000..5063c10971 --- /dev/null +++ b/EDDI/Themes/DarkTheme.xaml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/EDDPMonitor/ConfigurationWindow.xaml b/EDDPMonitor/ConfigurationWindow.xaml index 96b0ab8103..32ad2832bd 100644 --- a/EDDPMonitor/ConfigurationWindow.xaml +++ b/EDDPMonitor/ConfigurationWindow.xaml @@ -1,4 +1,4 @@ - - - - + + + + - - + + EDDI @@ -84,7 +57,7 @@ - + @@ -95,26 +68,32 @@ + - - - - - + - +