-
Notifications
You must be signed in to change notification settings - Fork 2
/
App.xaml.cs
48 lines (40 loc) · 1.43 KB
/
App.xaml.cs
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
namespace MsgBoxDemo
{
using System.Windows;
using System.Windows.Threading;
using MsgBox;
using ServiceLocator;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public App()
{
////Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
////Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
////Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
////Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
ServiceContainer.Instance.AddService<IMessageBoxService>(new MessageBoxService());
}
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
string message = string.Empty;
try
{
var msg = ServiceContainer.Instance.GetService<IMessageBoxService>();
msg.Show(
e.Exception, "An unexpected Error occured",
MsgBoxButtons.OK, MsgBoxImage.Error, MsgBoxResult.NoDefaultButton,
"http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=7799028",
"http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=7799028",
"Please click on the link to check if this is a known problem (and report it if not):");
}
catch
{
MessageBox.Show(message, "Error Report", MessageBoxButton.OK, MessageBoxImage.Error);
}
e.Handled = true;
}
}
}