App.xaml.cs 1.4 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;

namespace FLYAD7_Simulation_Wpf
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
        FLY.AppHelper.AppJustOne appjustone;
        FLY.AppHelper.WindowNotifyIconHelper notifyiconhelper;

        public App()
        {
            appjustone = new FLY.AppHelper.AppJustOne(this);

            AppDomain.CurrentDomain.UnhandledException += (s, e) =>
            {
                string err = e.ExceptionObject.ToString();
                var logger = NLog.LogManager.GetLogger("app");
                logger.Fatal(err);

                MessageBox.Show("程序出现异常,请把下面信息拍照发给厂家" + Environment.NewLine + err,
                    "异常,联系厂家",
                    MessageBoxButton.OK, MessageBoxImage.Error);
            };

            this.Startup += (s, e) =>
            {
                this.MainWindow = new MainWindow();

潘栩锋's avatar
潘栩锋 committed
37 38
                //Misc.Ver ver = new Misc.Ver();
                //ver.SrcType = this.GetType();
39

潘栩锋's avatar
潘栩锋 committed
40
                //this.MainWindow.Title = ver.ToString();
41 42 43 44
                notifyiconhelper = new FLY.AppHelper.WindowNotifyIconHelper(this.MainWindow, this.MainWindow.Title);
                this.MainWindow.Show();
            };
        }
潘栩锋's avatar
潘栩锋 committed
45 46
    }
}