Skip to content

Commit

Permalink
Catch ManagementExceptions when starting WindowsThemeService
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN committed Nov 7, 2023
1 parent d32729c commit 6842fe5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
8 changes: 7 additions & 1 deletion TwitchDownloaderWPF/Services/WindowsThemeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ public WindowsThemeService()
}
catch (ExternalException e)
{
MessageBox.Show(string.Format(Translations.Strings.UnableToStartWindowsThemeWatcher, $"0x{e.ErrorCode:x8}"), Translations.Strings.MessageBoxTitleError, MessageBoxButton.OK, MessageBoxImage.Error);
MessageBox.Show(string.Format(Translations.Strings.UnableToStartWindowsThemeWatcher, $"0x{e.ErrorCode:x8}"), Translations.Strings.MessageBoxTitleError,
MessageBoxButton.OK, MessageBoxImage.Information);
}
catch (ManagementException e)
{
MessageBox.Show(string.Format(Translations.Strings.UnableToStartWindowsThemeWatcher, $"{e.ErrorCode} (0x{(int)e.ErrorCode:x8})"), Translations.Strings.MessageBoxTitleError,
MessageBoxButton.OK, MessageBoxImage.Information);
}
}

Expand Down
3 changes: 1 addition & 2 deletions TwitchDownloaderWPF/Translations/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion TwitchDownloaderWPF/Translations/Strings.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@
<value>Erreur</value>
</data>
<data name="UnableToStartWindowsThemeWatcher" xml:space="preserve">
<value>Impossible de démarrer l'observateur de thème de l'application Windows. Code d'erreur : {0}</value>
<value>Impossible de démarrer l'observateur de thème de l'application Windows. La synchronisation des thèmes Windows en temps réel a été désactivée. Code d'erreur : {0}</value>
</data>
<data name="LabelVideosPerPage" xml:space="preserve">
<value>Vidéos par page:</value>
Expand Down
2 changes: 1 addition & 1 deletion TwitchDownloaderWPF/Translations/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@
<value>Error</value>
</data>
<data name="UnableToStartWindowsThemeWatcher" xml:space="preserve">
<value>Unable to start Windows application theme watcher. Error code: {0}</value>
<value>Unable to start Windows application theme watcher. Real-time Windows theme synchronization has been disabled. Error code: {0}</value>
</data>
<data name="LabelVideosPerPage" xml:space="preserve">
<value>Videos per page:</value>
Expand Down
10 changes: 5 additions & 5 deletions TwitchDownloaderWPF/TwitchDownloaderWPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Themes\Dark.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Themes\Light.xaml">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Themes\README.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Themes\README.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TwitchDownloaderCore\TwitchDownloaderCore.csproj" />
Expand Down

0 comments on commit 6842fe5

Please sign in to comment.