-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.xaml.cs
46 lines (41 loc) · 1.34 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
using System;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Windows;
using System.Windows.Threading;
namespace CoinTrack
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private void Application_Startup(object sender, StartupEventArgs e)
{
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
Dispatcher.UnhandledException += OnUnhandledException;
AppDomain.CurrentDomain.ProcessExit += delegate
{
var directory = new DirectoryInfo(Directory.GetCurrentDirectory());
foreach (var file in directory.GetFiles("chart.*.png"))
{
try
{
file.Delete();
}
catch
{
// do nothing
}
}
};
}
private void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
MessageBox.Show(e.Exception.Message, "Oops…", MessageBoxButton.OK, MessageBoxImage.Error);
e.Handled = true;
}
}
}