using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace FLY.Thick.Blowing360.UI.Client
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        FLY.AppHelper.AppJustOne appjustone;

        public App()
        {
            appjustone = new 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 MultiLayout.MainWindow();
                this.MainWindow.Title = "中国塑控 China Plastic Control";
                this.MainWindow.Loaded += (_s, _e) =>
                {
                    //启动Poll系统
                    FObjBase.PollModule.Current.Start();
                };
                this.MainWindow.Show();
            };
        }

    }
}