private async void EditNote(GameStats selected) { if (selected == null) { return; } var settings = new MessageDialogs.Settings { DefaultText = selected.Note }; string newNote; if (Config.Instance.StatsInWindow) { newNote = await Core.Windows.StatsWindow.ShowInputAsync("Note", "", settings); } else { newNote = await Core.MainWindow.ShowInputAsync("Note", "", settings); } if (newNote == null) { return; } selected.Note = newNote; DeckStatsList.Save(); Refresh(); }
private async void ButtonEditNote_OnClick(object sender, RoutedEventArgs e) { if (SelectedGame == null) { return; } var settings = new MessageDialogs.Settings { DefaultText = SelectedGame.Note }; string newNote; if (Config.Instance.StatsInWindow) { newNote = await Core.Windows.StatsWindow.ShowInputAsync("Note", "", settings); } else { newNote = await Core.MainWindow.ShowInputAsync("Note", "", settings); } if (newNote == null) { return; } SelectedGame.Note = newNote; DeckStatsList.Save(); DefaultDeckStats.Save(); }
private static async void ShowNewUpdateMessage(bool beta) { if (_showingUpdateMessage) { return; } _showingUpdateMessage = true; var settings = new MessageDialogs.Settings { AffirmativeButtonText = "Download", NegativeButtonText = "Not now" }; if (_release == null) { _showingUpdateMessage = false; return; } try { await Task.Delay(10000); Core.MainWindow.ActivateWindow(); while (Core.MainWindow.Visibility != Visibility.Visible || Core.MainWindow.WindowState == WindowState.Minimized) { await Task.Delay(100); } var betaString = beta ? " BETA" : ""; var result = await Core.MainWindow.ShowMessageAsync("New" + betaString + " Update available!", "Press \"Download\" to automatically download.", MessageDialogStyle.AffirmativeAndNegative, settings); if (result == MessageDialogResult.Affirmative) { StartUpdate(); } else { TempUpdateCheckDisabled = true; } _showingUpdateMessage = false; } catch (Exception e) { _showingUpdateMessage = false; Log.Error("Error showing new update message\n" + e); } }
private static async void ShowNewUpdateMessage(bool beta) { if (_showingUpdateMessage) { return; } _showingUpdateMessage = true; var settings = new MessageDialogs.Settings { AffirmativeButtonText = LocUtil.Get("Button_Download"), NegativeButtonText = LocUtil.Get("Button_Notnow") }; if (_release == null) { _showingUpdateMessage = false; return; } try { await Task.Delay(10000); Core.MainWindow.ActivateWindow(); while (Core.MainWindow.Visibility != Visibility.Visible || Core.MainWindow.WindowState == WindowState.Minimized) { await Task.Delay(100); } var updateString = beta ? LocUtil.Get("MainWindow_StatusBarUpdate_NewBETAUpdateAvailable") : LocUtil.Get("MainWindow_StatusBarUpdate_NewUpdateAvailable"); var result = await DialogManager.ShowMessageAsync(Core.MainWindow, updateString, LocUtil.Get("MainWindow_ShowMessage_UpdateDialog"), MessageDialogStyle.AffirmativeAndNegative, settings); if (result == MessageDialogResult.Affirmative) { StartUpdate(); } else { TempUpdateCheckDisabled = true; } _showingUpdateMessage = false; } catch (Exception e) { _showingUpdateMessage = false; Log.Error("Error showing new update message\n" + e); } }
public static async Task SetupConstructedImporting(GameV2 game) { var settings = new MessageDialogs.Settings { AffirmativeButtonText = "continue" }; if (!game.IsRunning) { await Core.MainWindow.ShowMessageAsync("Step 0:", "Start Hearthstone", settings : settings); } await Core.MainWindow.ShowMessageAsync("Step 1:", "Go to the main menu", settings : settings); SettingUpConstructedImporting = true; await Core.MainWindow.ShowMessageAsync("Step 2:", "Open \"My Collection\" and click each class icon at the top once.\n\n- Do not click on neutral\n- Do not open any decks\n- Do not flip the pages.", settings : new MessageDialogs.Settings { AffirmativeButtonText = "done" }); Config.Instance.ConstructedImportingIgnoreCachedIds = game.PossibleConstructedCards.Select(c => c.Id).ToArray(); Config.Save(); SettingUpConstructedImporting = false; }
private static async void ShowNewUpdateMessage(Version newVersion, bool beta) { if (_showingUpdateMessage) { return; } _showingUpdateMessage = true; const string releaseDownloadUrl = @"https://github.com/Epix37/Hearthstone-Deck-Tracker/releases"; var settings = new MessageDialogs.Settings { AffirmativeButtonText = "Download", NegativeButtonText = "Not now" }; if (newVersion == null) { _showingUpdateMessage = false; return; } try { await Task.Delay(10000); Core.MainWindow.ActivateWindow(); while (Core.MainWindow.Visibility != Visibility.Visible || Core.MainWindow.WindowState == WindowState.Minimized) { await Task.Delay(100); } var newVersionString = $"{newVersion.Major}.{newVersion.Minor}.{newVersion.Build}"; var betaString = beta ? " BETA" : ""; var result = await Core.MainWindow.ShowMessageAsync("New" + betaString + " Update available!", "Press \"Download\" to automatically download.", MessageDialogStyle.AffirmativeAndNegative, settings); if (result == MessageDialogResult.Affirmative) { //recheck, in case there was no immediate response to the dialog if ((DateTime.Now - _lastUpdateCheck) > new TimeSpan(0, 10, 0)) { newVersion = await Helper.CheckForUpdates(beta); if (newVersion != null) { newVersionString = $"{newVersion.Major}.{newVersion.Minor}.{newVersion.Build}"; } } try { Process.Start("HDTUpdate.exe", $"{Process.GetCurrentProcess().Id} {newVersionString}"); Core.MainWindow.Close(); Application.Current.Shutdown(); } catch { Logger.WriteLine("Error starting updater"); Process.Start(releaseDownloadUrl); } } else { TempUpdateCheckDisabled = true; } _showingUpdateMessage = false; } catch (Exception e) { _showingUpdateMessage = false; Logger.WriteLine("Error showing new update message\n" + e.Message); } }