-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssemblyInfo.cs
More file actions
30 lines (26 loc) · 1.38 KB
/
AssemblyInfo.cs
File metadata and controls
30 lines (26 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System.Windows;
//------------------------------------------------------------------------------
// AssemblyInfo.cs
// Contains assembly-level attributes for the WPF application.
//------------------------------------------------------------------------------
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, // Specifies that there are no theme-specific resource dictionaries.
// (Used if a resource is not found in the page or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly // Specifies that the generic resource dictionary is located in the source assembly.
// (Used if a resource is not found in the page, app, or any theme-specific resource dictionaries)
)]
// In App.xaml.cs
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
this.DispatcherUnhandledException += App_DispatcherUnhandledException;
base.OnStartup(e);
}
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
// Log the exception and show a user-friendly message
MessageBox.Show("An unexpected error occurred. Please contact support.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
e.Handled = true;
}
}