예제 #1
0
        public static void ApplyGameConfigParams(IGame game)
        {
            if (!GameHelper.IsValidForGame(game))
            {
                return;
            }

            if (GameHelper.IsGameConfigured(game))
            {
                SetGameConfigParams(game);
            }

            if (!GameHelper.IsGameConfigured(game))
            {
                ClearGameConfigParams(game);
            }
        }
        private void InitializeConfigWindow()
        {
            ((OutlinedTextBlock)ConfiguredLbl.Content).Text = "[Game Name]: [Configured]";
            ((OutlinedTextBlock)ConfiguredLbl.Content).Text = ((OutlinedTextBlock)ConfiguredLbl.Content).Text.Replace("[Game Name]", _selectedGame.Title);
            ((OutlinedTextBlock)ConfiguredLbl.Content).Text = GameHelper.IsGameConfigured(_selectedGame)
                ? ((OutlinedTextBlock)ConfiguredLbl.Content).Text.Replace("[Configured]", "Configured")
                : ((OutlinedTextBlock)ConfiguredLbl.Content).Text.Replace("[Configured]", "Not Configured");

            ((OutlinedTextBlock)DownloadConfigBtnLbl.Content).Text = "[Download] Config";
            ((OutlinedTextBlock)DownloadConfigBtnLbl.Content).Text = GameHelper.IsGameUsingRemoteConfig(_selectedGame)
                ? ((OutlinedTextBlock)DownloadConfigBtnLbl.Content).Text.Replace("[Download]", "Update")
                : ((OutlinedTextBlock)DownloadConfigBtnLbl.Content).Text.Replace("[Download]", "Download");

            DisableControl(DownloadConfigBtnLbl, DownloadConfigBtnBtn);
            _selectedGameRemoteConfigPathTask.ContinueWith(remoteConfigPath =>
            {
                if (!GameHelper.IsGameUsingRemoteConfig(_selectedGame))
                {
                    if (remoteConfigPath.Result != null)
                    {
                        Dispatcher.Invoke(() => EnableControl(DownloadConfigBtnLbl, DownloadConfigBtnBtn));
                    }
                }
                else
                {
                    if (Configurator.CheckForConfigUpdates(remoteConfigPath.Result))
                    {
                        Dispatcher.Invoke(() => EnableControl(DownloadConfigBtnLbl, DownloadConfigBtnBtn));
                    }
                }
            });

            if (!GameHelper.IsGameConfigured(_selectedGame))
            {
                DisableControl(RemoveConfigBtnLbl, RemoveConfigBtnBtn);
                DisableControl(ConfigureWithPcsx2BtnLbl, ConfigureWithPcsx2BtnBtn);
            }
            else
            {
                EnableControl(RemoveConfigBtnLbl, RemoveConfigBtnBtn);
                EnableControl(ConfigureWithPcsx2BtnLbl, ConfigureWithPcsx2BtnBtn);
            }
        }
        private void CreateConfigBtn_Click(object sender, RoutedEventArgs e)
        {
            var createConfig = true;

            if (GameHelper.IsGameConfigured(_selectedGame))
            {
                var msgResult = MessageDialog.Show(this, MessageDialog.Type.ConfigOverwriteConfirm);

                if (msgResult != true)
                {
                    createConfig = false;
                }
            }

            if (!createConfig)
            {
                return;
            }
            Configurator.CreateConfig(_selectedGame);
            MessageDialog.Show(this, MessageDialog.Type.ConfigConfiguredSuccess);
            InitializeConfigWindow();
        }