57 lines
1.7 KiB
C#
57 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
|
|
namespace CoopMerchantClient
|
|
{
|
|
/// <summary>
|
|
/// App.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class App : Application
|
|
{
|
|
System.Threading.Mutex mutex;
|
|
|
|
/// <summary>
|
|
/// 程序入口
|
|
/// </summary>
|
|
public App()
|
|
{
|
|
//AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
|
|
DispatcherUnhandledException += App_DispatcherUnhandledException;
|
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
|
Startup += new StartupEventHandler(App_Startup);
|
|
}
|
|
|
|
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
{
|
|
Transmission.SDK.LogHelper.WriteServiceLog("线程异常:" + (e.ExceptionObject as Exception).Message);
|
|
}
|
|
|
|
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
|
{
|
|
e.Handled = true;
|
|
Transmission.SDK.LogHelper.WriteServiceLog("主程序异常:" + e.Exception.Message);
|
|
Environment.Exit(0);
|
|
}
|
|
|
|
private void App_Startup(object sender, StartupEventArgs e)
|
|
{
|
|
bool ret;
|
|
mutex = new System.Threading.Mutex(true, System.Windows.Forms.Application.ProductName, out ret);
|
|
if (!ret)
|
|
{
|
|
Environment.Exit(0);
|
|
}
|
|
else
|
|
{
|
|
MainWindow _MainWindow = new MainWindow();
|
|
_MainWindow.Show();
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|