コード例 #1
0
ファイル: Program.cs プロジェクト: donkz/extraQL
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, args) => HandleException(args.ExceptionObject as Exception);
              Application.ThreadException += (sender, args) => HandleException(args.Exception);

              try
              {
            bool isPostUpdate = Environment.CommandLine == PostUpdateSwitch;

            Config config = new Config();
            config.LoadSettings();
            if (!isPostUpdate && ActivateRunningInstance(config.GetBool("https")))
              return;

            Application.EnableVisualStyles();

            var updater = new Updater(config);
            if (!isPostUpdate)
              updater.Run();

            var mainForm = new MainForm(config, updater);
            if (Environment.CommandLine.Contains(WinServiceSwitch))
              WinService.Start(mainForm);
            else
              Application.Run(mainForm);
              }
              catch (Exception ex)
              {
            HandleException(ex);
              }
        }