-
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.33 KB
/
App.xaml.cs
File metadata and controls
45 lines (37 loc) · 1.33 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.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.Threading;
using SuperSocket.ServerManager.Client.Config;
using SuperSocket.ServerManager.Client.ViewModel;
namespace SuperSocket.ServerManager.Client
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private Mutex m_SigleInstanceMutex;
internal static AgentConfig Config { get; private set; }
protected override void OnStartup(StartupEventArgs e)
{
bool createdNew;
m_SigleInstanceMutex = new Mutex(true, AppDomain.CurrentDomain.FriendlyName, out createdNew);
if (!createdNew)
this.Shutdown();
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
var mainWindow = new MainWindow();
mainWindow.DataContext = new MainViewModel(AgentConfig.Load());
this.MainWindow = mainWindow;
mainWindow.Show();
base.OnStartup(e);
}
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
//MessageBox.Show(e.ExceptionObject.ToString());
}
}
}