Esempio n. 1
0
        private void OnGameExited(int exitCode)
        {
            IsLaunching = false;
            LaunchProcessEnded?.Invoke();

            Execute.OnUIThread(() =>
            {
                GreetingVM.IsShown = true;

                if (_config.AfterLaunch != AfterLaunchBehavior.Exit && exitCode != 0 && _logger.Length > 0)
                {
                    _errorReportVM.ErrorMessage = $"Exit Code: {exitCode}\n" + _logger.ToString();
                    _errorReportVM.Type         = ErrorReportType.UnexpectedExit;

                    _windowManager.ShowDialog(_errorReportVM);

                    Debug.WriteLine("[Game exited with errors]");
                    Debug.WriteLine(_logger.ToString());
                    _logger.Clear();
                }

                if (_config.AfterLaunch == AfterLaunchBehavior.Hide)
                {
                    Application.Current.MainWindow.Show();
                    Application.Current.MainWindow.Activate();
                }
            });
        }
Esempio n. 2
0
        private void OnLaunchCompleted()
        {
            if (_statusVM.Status == LaunchStatus.Failed)
            {
                IsLaunching        = false;
                GreetingVM.IsShown = true;
                LaunchProcessEnded?.Invoke();
                return;
            }

            if (_statusVM.Status == LaunchStatus.Running)
            {
                if (_config.AfterLaunch == AfterLaunchBehavior.Exit)
                {
                    Application.Current.Shutdown(0);
                }

                if (_config.AfterLaunch == AfterLaunchBehavior.Hide)
                {
                    _logService.Info(nameof(LaunchViewModel), "Hiding window");

                    Application.Current.MainWindow.Hide();
                }
            }
        }
Esempio n. 3
0
        private void OnGameExited(int exitCode)
        {
            IsLaunching = false;
            LaunchProcessEnded?.Invoke();

            Execute.OnUIThread(() =>
            {
                GreetingVM.IsShown = true;

                if (_config.AfterLaunch != AfterLaunchBehavior.Exit && exitCode != 0)
                {
                    _errorReportVM.Setup(ErrorReportType.UnexpectedExit);
                    _windowManager.ShowDialog(_errorReportVM);
                }

                if (_config.AfterLaunch == AfterLaunchBehavior.Hide)
                {
                    _logService.Info(nameof(LaunchViewModel), "Restoring window");

                    Application.Current.MainWindow.Show();
                    Application.Current.MainWindow.Activate();
                }
            });
        }