コード例 #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            LogBasicInfo();

            ProcessController.CheckSingleton(ProcessName, (IntPtr)Settings.Default.WindowHandle);
            ConfigureApplicationEventHandlers();
            base.OnStartup(e);
        }
コード例 #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            Settings.Default.PropertyChanged += (sender, eventArgs) => Settings.Default.Save();

            ProcessController.CheckSingleton();

            base.OnStartup(e);

            new Bootstrapper().Run();
        }
コード例 #3
0
        protected override void OnExit(ExitEventArgs e)
        {
            if (Container != null)
            {
                Container.Resolve <IUpgradeService>().Stop();
                Container.Resolve <IEventAggregator>().GetEvent <ApplicationExiting>().Publish();
                (Container.Resolve <ILoggerFacade>() as IDisposable)?.Dispose();
            }

            ProcessController.Clear();

            base.OnExit(e);
        }
コード例 #4
0
        private void Log(Exception exception)
        {
            Logger.Fatal("An uncaught exception occurred", exception);

            if (_isShowed)
            {
                return;
            }

            _isShowed = true;
            switch (exception)
            {
            case NotImplementedException _:
                MessageBox.Show(
                    "Sorry! The feature has NOT been IMPLEMENTED. Please wait for the next version. ",
                    "Fatal",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
                break;

            case NotSupportedException _:
                MessageBox.Show(
                    "Sorry! The feature has NOT been SUPPORTED. Please wait for the next version. ",
                    "Fatal",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
                break;

            default:
                var result = MessageBox.Show(
                    $"Sorry! An uncaught EXCEPTION occurred. {Environment.NewLine}" +
                    $"You can pack and send log files in %AppData%\\Accelerider\\Logs to the developer. Thank you! {Environment.NewLine}{Environment.NewLine}" +
                    $"Do you want to open the Logs folder? ",
                    "Fatal",
                    MessageBoxButton.YesNo,
                    MessageBoxImage.Error);

                if (result == MessageBoxResult.Yes)
                {
                    Process.Start(AcceleriderFolders.Logs);
                }

                break;
            }

            ProcessController.Restart(-1);
        }
コード例 #5
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ProcessController.CheckSingleton();

            base.OnStartup(e);
        }