-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.xaml.cs
More file actions
45 lines (37 loc) · 1.32 KB
/
Copy pathApp.xaml.cs
File metadata and controls
45 lines (37 loc) · 1.32 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Windows;
namespace FilePairing
{
/// <summary>
/// App.xaml の相互作用ロジック
/// </summary>
public partial class App
{
// Logger
private static readonly log4net.ILog Logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod()?.DeclaringType);
// Main method
[STAThreadAttribute()]
public static void Main()
{
var app = new App();
app.InitializeComponent();
app.Startup += App_Startup;
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
{
if (!(e.ExceptionObject is Exception exception)) return;
Logger.Error(exception);
MessageBox.Show("アプリケーションで例外が発生しました。内容をログファイルに記述し、アプリケーションを終了します。", "システムエラー", MessageBoxButton.OK, MessageBoxImage.Error);
};
app.Run();
}
/// <summary>
/// Startup event
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void App_Startup(object sender, StartupEventArgs e)
{
new MainWindow().Show();
}
}
}