You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
1.8 KiB

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace ConUpdate
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
internal string info = "";
private LogHelper log = new LogHelper();
private void Application_Startup(object sender, StartupEventArgs e)
{
try
{
if (e.Args.Any())
{
log.WriteInfoFile("收到" + e.Args[0].ToString());
info = e.Args[0].ToString();
MainWindow win = new MainWindow(info);
win.Show();
}
else
{
Environment.Exit(0);
}
}
catch (Exception ex)
{
log.WriteInfoFile(ex.ToString());
Environment.Exit(0);
}
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.Current.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Current_DispatcherUnhandledException);
}
private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
log.WriteInfoFile(e.Exception.Message + e.Exception.StackTrace);
}
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception ex = (Exception)e.ExceptionObject;
log.WriteInfoFile(ex.ToString());
}
}
}