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 DownloadConfigBtn_Click(object sender, RoutedEventArgs e) { if (!GameHelper.IsGameUsingRemoteConfig(_selectedGame)) { Mouse.OverrideCursor = Cursors.Wait; var result = Configurator.DownloadConfig(_selectedGame, _selectedGameRemoteConfigPathTask.Result); Mouse.OverrideCursor = null; MessageDialog.Show(this, result ? MessageDialog.Type.ConfigDownloadSuccess : MessageDialog.Type.ConfigDownloadError); } else { Mouse.OverrideCursor = Cursors.Wait; Configurator.UpdateGameConfig(_selectedGame, _selectedGameRemoteConfigPathTask.Result); Mouse.OverrideCursor = null; MessageDialog.Show(this, MessageDialog.Type.ConfigUpdateSuccess); } InitializeConfigWindow(); }