Beispiel #1
0
        private async void loadAsync(bool askForGameContentLocation)
        {
            bool canContinue = true;
            //check default install locations
            string?paksFolderPath = _model.usableGameContentIfExists();

            if (askForGameContentLocation || string.IsNullOrWhiteSpace(paksFolderPath))
            {
                //show dialog asking for install location
                canContinue = showGameFilesWindow(ref paksFolderPath);
            }

            if (!string.IsNullOrWhiteSpace(paksFolderPath))
            {
                try
                {
                    await loadGameContentAsync(paksFolderPath !);
                }
                catch (Exception e)
                {
                    //Clear the path saved in the registry because it might be the cause of the exception
                    _model.unloadGameContent();

                    var title   = $"{Constants.APPLICATION_NAME} {Constants.CURRENT_VERSION_NUMBER} - {R.ERROR}";
                    var message = $"{e.Message}\n\n{R.PLEASE_HAVE_LATEST_VERSION}\n\n{R.LAUNCH_WITH_LIMITED_FEATURES_QUESTION}";
                    var result  = MessageBox.Show(message, title, MessageBoxButton.YesNo);
                    canContinue = result == MessageBoxResult.Yes || result == MessageBoxResult.OK;
                }
            }
            else
            {
                //Clear the path saved in the registry
                _model.unloadGameContent();
            }

            if (!canContinue)
            {
                //User opted to Exit
                _splashWindow?.Close();
                closeBusyIndicator();
                this.MainWindow?.Close();
                this.Shutdown();
                return;
            }

            showMainWindow();
        }
Beispiel #2
0
        private void load()
        {
            //check default install locations
            string?paksFolderPath = _model.usableGameContentIfExists();

            if (_askForGameContentLocation || string.IsNullOrWhiteSpace(paksFolderPath))
            {
                //show dialog asking for install location
                EventLogger.logEvent("showGameFilesWindow");
                var gameFilesWindow = new GameFilesWindow(allowNoContent: true);
                gameFilesWindow.Owner = this.MainWindow;
                gameFilesWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                gameFilesWindow.ShowDialog();
                var gameFilesWindowResult = gameFilesWindow.result;
                switch (gameFilesWindowResult)
                {
                case GameFilesWindow.GameFilesWindowResult.exit:
                    this.Shutdown();
                    break;

                case GameFilesWindow.GameFilesWindowResult.useSelectedPath:
                    loadGameContentAsync(gameFilesWindow.selectedPath !);
                    break;

                case GameFilesWindow.GameFilesWindowResult.noContent:
                    showMainWindow();
                    break;
                }
            }
            else
            {
                try
                {
                    loadGameContentAsync(paksFolderPath !);
                }
                catch (Exception e)
                {
                    MessageBox.Show($"{e.Message}\n{e.StackTrace}", R.ERROR);
                    this.Shutdown();
                    return;
                }
            }
        }