public static async Task ShowSavedFileMessage(this MainWindow window, string fileName) { var result = await window.ShowMessageAsync("", LocUtil.Get(LocSavedFileText) + Environment.NewLine + Environment.NewLine + fileName, AffirmativeAndNegative, new Settings { AffirmativeButtonText = LocUtil.Get(LocSavedFileButtonOk), NegativeButtonText = LocUtil.Get(LocSavedFileButtonOpen) }); if (result == MessageDialogResult.Negative) { Process.Start(Path.GetDirectoryName(fileName)); } }
private string GetTagText(Deck deck) { var predefined = new List<string>() { "Midrange", "Aggro", "Control", "Tempo", "Combo" }; if(deck.Tags.Count > 0) foreach(var tag in predefined) if(_allTags.Contains(tag.ToLowerInvariant())) return tag; return LocUtil.Get(deck.Class); }
public void AgeTest() { Assert.AreEqual("0 minutes ago", LocUtil.GetAge(DateTime.Now)); Assert.AreEqual("0 minutes ago", LocUtil.GetAge(DateTime.Now.AddSeconds(59))); Assert.AreEqual("1 minute ago", LocUtil.GetAge(DateTime.Now.AddMinutes(-1))); Assert.AreEqual("1 minute ago", LocUtil.GetAge(DateTime.Now.AddMinutes(-1).AddSeconds(-59))); Assert.AreEqual("2 minutes ago", LocUtil.GetAge(DateTime.Now.AddMinutes(-2))); Assert.AreEqual("59 minutes ago", LocUtil.GetAge(DateTime.Now.AddMinutes(-59))); Assert.AreEqual("1 hour ago", LocUtil.GetAge(DateTime.Now.AddHours(-1))); Assert.AreEqual("1 hour ago", LocUtil.GetAge(DateTime.Now.AddHours(-1).AddMinutes(-59))); Assert.AreEqual("2 hours ago", LocUtil.GetAge(DateTime.Now.AddHours(-2))); Assert.AreEqual("23 hours ago", LocUtil.GetAge(DateTime.Now.AddHours(-23))); Assert.AreEqual("23 hours ago", LocUtil.GetAge(DateTime.Now.AddHours(-23).AddMinutes(-59))); Assert.AreEqual("1 day ago", LocUtil.GetAge(DateTime.Now.AddDays(-1))); Assert.AreEqual("1 day ago", LocUtil.GetAge(DateTime.Now.AddDays(-1).AddHours(-23))); Assert.AreEqual("2 days ago", LocUtil.GetAge(DateTime.Now.AddDays(-2))); }
private void GetAngle(int id) { byte angle; byte[] buffer; if (!UBTGetAngle(id, out angle, out buffer)) { return; } int iAngle = (buffer[4] << 8) | buffer[5]; int iActual = (buffer[6] << 8) | buffer[7]; string result = String.Format(LocUtil.FindResource("ubt.msgShowAngle"), buffer[4], buffer[5], iAngle, buffer[6], buffer[7], iActual); SetCurrAngle(buffer[7]); AppendLog(result); }
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); } }
// A9 9A 02 0A 0C ED private void CheckCommandMode() { byte[] cmd = { 0xA9, 0x9A, 0x02, 0x0A, 0x0C, 0xED }; SendCBCommand(cmd, 12); if (robot.Available == 12) { byte[] result = robot.ReadAll(); String msg = ""; if (result[4] != 0) { msg += " V1"; } if (result[5] != 0) { msg += " V2"; } if (result[6] != 0) { msg += " BT"; } if (result[7] != 0) { msg += " CB"; } if (result[8] != 0) { msg += " SV"; } if (result[9] != 0) { msg += " HaiLzd"; } if (msg == "") { msg = LocUtil.FindResource("cb.msgNoCommandSupported"); } else { msg = LocUtil.FindResource("cb.msgSupportedCommand") + msg; } AppendLog(msg); } robot.ClearRxBuffer(); }
public AddGameDialog(Deck deck) : this() { _editing = false; var lastGame = deck.DeckStats.Games.LastOrDefault(); if (deck.IsArenaDeck) { ComboBoxMode.SelectedItem = Arena; ComboBoxMode.IsEnabled = false; } else { ComboBoxMode.IsEnabled = true; TextBoxRank.IsEnabled = true; TextBoxLegendRank.IsEnabled = true; TextBoxLeagueId.IsEnabled = true; TextBoxStarLevel.IsEnabled = true; if (lastGame != null) { ComboBoxFormat.SelectedItem = lastGame.Format; ComboBoxMode.SelectedItem = lastGame.GameMode; if (lastGame.GameMode == Ranked) { TextBoxRank.Text = lastGame.Rank.ToString(); TextBoxLegendRank.Text = lastGame.LegendRank.ToString(); TextBoxLeagueId.Text = lastGame.LeagueId.ToString(); TextBoxStarLevel.Text = lastGame.StarLevel.ToString(); } } } if (lastGame != null) { PanelRank.Visibility = PanelLegendRank.Visibility = lastGame.GameMode == Ranked ? Visible : Collapsed; PanelFormat.Visibility = lastGame.GameMode == Ranked || lastGame.GameMode == Casual ? Visible : Collapsed; TextBoxPlayerName.Text = lastGame.PlayerName; if (lastGame.Region != Region.UNKNOWN) { ComboBoxRegion.SelectedItem = lastGame.Region; } } _deck = deck; _game = new GameStats(); BtnSave.Content = LocUtil.Get(LocAddGame); Title = _deck.Name; }
private void SetLed(int id, bool mode) { byte[] cmd = { 0xFA, 0xAF, (byte)id, 0x04, (byte)(mode ? 0x00 : 0x01), 0, 0, 0, 0, 0xED }; SendCommand(cmd, 10); if ((id != 0) && (robot.Available == 1)) { byte[] buffer = robot.ReadAll(); string action = LocUtil.FindResource(mode ? "ubt.msgLedOn" : "ubt.msgLedOff"); if (buffer[0] == (0xAA + id)) { AppendLog(String.Format(LocUtil.FindResource("ubt.msgSetLedSuccess"), id, action)); } else { AppendLog(String.Format(LocUtil.FindResource("ubt.msgSetLedFail"), id, action)); } } }
public static async Task <SaveScreenshotOperation> ShowScreenshotUploadSelectionDialog(this MainWindow window) { var result = await window.ShowMessageAsync(LocUtil.Get(LocScreenshotActionTitle), LocUtil.Get(LocScreenshotActionDescription), AffirmativeAndNegativeAndDoubleAuxiliary, new Settings { AffirmativeButtonText = LocUtil.Get(LocScreenshotActionButtonSave), NegativeButtonText = LocUtil.Get(LocScreenshotActionButtonSaveUpload), FirstAuxiliaryButtonText = LocUtil.Get(LocScreenshotActionButtonUpload), SecondAuxiliaryButtonText = LocUtil.Get(LocScreenshotActionButtonCancel) }); return(new SaveScreenshotOperation { Cancelled = result == MessageDialogResult.SecondAuxiliary, SaveLocal = result != MessageDialogResult.FirstAuxiliary, Upload = result != MessageDialogResult.Affirmative }); }
public static async Task ShowLogConfigUpdateFailedMessage(this MetroWindow window) { var settings = new Settings { AffirmativeButtonText = LocUtil.Get(LocLogConfigButtonInstructions), NegativeButtonText = LocUtil.Get(LocLogConfigButtonClose) }; var result = await window.ShowMessageAsync(LocUtil.Get(LocLogConfigTitle), LocUtil.Get(LocLogConfigDescription1) + Environment.NewLine + Environment.NewLine + LocUtil.Get(LocLogConfigDescription2) + Environment.NewLine + Environment.NewLine + LocUtil.Get(LocLogConfigDescription3), AffirmativeAndNegative, settings); if (result == MessageDialogResult.Affirmative) { Helper.TryOpenUrl("https://github.com/HearthSim/Hearthstone-Deck-Tracker/wiki/Setting-up-the-log.config"); } }
private async void Upload() { UploadButtonEnabled = false; UploadButtonText = LocUtil.Get(ImgurUploading, true); var url = await DeckScreenshotHelper.Upload(DeckImage); if (url == null) { UploadErrorVisibility = Visibility.Visible; UploadButtonEnabled = true; UploadButtonText = LocUtil.Get(ImgurDefault, true); } else { ImgurUrl = url; UploadButtonText = LocUtil.Get(ImgurUploaded, true); } }
//public MenuItem MenuItemStartMIU { get; } public TrayIcon() { NotifyIcon = new NotifyIcon { Visible = true, ContextMenu = new ContextMenu(), Text = "Mix-It-Up" }; var iconFile = new FileInfo("Images/Mix-It-Up.ico"); if (iconFile.Exists) { NotifyIcon.Icon = new Icon(iconFile.FullName); } else { Log.Error($"Can't find tray icon at \"{iconFile.FullName}\""); } //MenuItemStartMIU = new MenuItem(LocUtil.Get("TrayIcon_MenuItemStartMIU"), (sender, args) => MIURunner.StartMIU().Forget()); //NotifyIcon.ContextMenu.MenuItems.Add(MenuItemStartMIU); //MIURunner.StartingMIU += starting => MenuItemStartMIU.Enabled = !starting; MenuItemShow = new MenuItem(LocUtil.Get("TrayIcon_MenuItemShow"), (sender, args) => Core.MainWindow.ActivateWindow()); NotifyIcon.ContextMenu.MenuItems.Add(MenuItemShow); MenuItemExit = new MenuItem(LocUtil.Get("TrayIcon_MenuItemExit"), (sender, args) => { Core.MainWindow.ExitRequestedFromTray = true; Core.MainWindow.Close(); }); NotifyIcon.ContextMenu.MenuItems.Add(MenuItemExit); NotifyIcon.MouseClick += (sender, args) => { if (args.Button == MouseButtons.Left) { Core.MainWindow.ActivateWindow(); } }; NotifyIcon.BalloonTipClicked += (sender1, e) => { Core.MainWindow.ActivateWindow(); }; }
private void ExitUSBTTL() { if (robot.currMode == RobotConnection.connMode.Network) { if (!MessageConfirm(LocUtil.FindResource("cb.msgConfirmQuitUSBTTL"))) { return; } } byte[] cmd = { 0xA9, 0x9A, 0x01, 0x06, 0x09 }; AppendLog("\n" + (robot.isConnected ? ">> " : "") + UTIL.GetByteString(cmd) + "\n"); robot.ClearRxBuffer(); if (robot.isConnected) { robot.SendCommand(cmd, cmd.Length, 0); AppendLog(LocUtil.FindResource("cb.msgQuitUSBTTLSent")); } }
/// <summary> /// Sets the character name to display on the Say Dialog. /// Supports variable substitution e.g. John {$surname} /// </summary> public virtual void SetCharacterName(string name, Color color) { if (string.IsNullOrEmpty(name)) { nameBox.SetActive(false); return; } nameBox.SetActive(true); if (nameText != null) { var subbedName = LocUtil.TranslateWithDefault(name, name); nameText.text = subbedName; } if (nameColorGraphic != null) { nameColorGraphic.color = color; } }
public MainViewModel() { notify = new NotificationDialogService(); log = new Log(); CheckPowerStatusCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { MainModel = MainProcessor.getPowerStatus(); }); GetHDDInfoCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { hddCollection = MainProcessor.getHardDriveInfo(); }); CheckInternetCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { MainModel.IsConnectedInternet = Helper.IsNetworkAvailable(); }); EnglishCommand = new RelayCommand <FrameworkElement>((e) => { return(true); }, (e) => { LocUtil.SwitchLanguage(e, "en-US"); LanguageCollection = MainProcessor.getLanguages(); LanguageWindow lw = new LanguageWindow(); lw.ShowDialog(); }); ChinaCommand = new RelayCommand <FrameworkElement>((e) => { return(true); }, (e) => { LocUtil.SwitchLanguage(e, "zh-CN"); //AboutWindow aw = new AboutWindow(); //aw.ShowDialog(); var newNotification = new Notification() { Title = "Test Fail", Message = "Test one Fail Please check your Machine Code and Try Again" // ,ImgURL = "pack://application:,,,a/Resources/Images/warning.png" }; var notificationConfiguration = NotificationConfiguration.DefaultConfiguration; notify.Show(newNotification, notificationConfiguration); }); SaveLanguageCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { MainProcessor.SaveLanguage(this.LanguageCollection); }); //Log.Error("Test2", "Test2"); //var lst = Log.GetListErrors(); initData(); //iup.UnInstall("{c166523c-fe0c-4a94-a586-f1a80cfbbf3e}"); }
public void SetCardCount(int cardCount, int cardsLeftInDeck) { LblCardCount.Text = cardCount.ToString(); LblDeckCount.Text = cardsLeftInDeck.ToString(); if (cardsLeftInDeck <= 0) { LblPlayerFatigue.Text = LocUtil.Get(LocFatigue) + " " + (_game.Player.Fatigue + 1); LblDrawChance2.Text = "0%"; LblDrawChance1.Text = "0%"; return; } LblPlayerFatigue.Text = ""; LblDrawChance2.Text = Math.Round(200.0f / cardsLeftInDeck, 1) + "%"; LblDrawChance1.Text = Math.Round(100.0f / cardsLeftInDeck, 1) + "%"; }
internal void UpdateMenuItemVisibility() { var deck = DeckPickerList.SelectedDecks.FirstOrDefault() ?? DeckList.Instance.ActiveDeck; if (deck == null) { return; } MenuItemMoveDecktoArena.Visibility = deck.IsArenaDeck ? Collapsed : Visible; MenuItemMoveDeckToConstructed.Visibility = deck.IsArenaDeck ? Visible : Collapsed; MenuItemMissingCards.Visibility = deck.MissingCards.Any() ? Visible : Collapsed; MenuItemSetDeckUrl.Visibility = deck.IsArenaDeck ? Collapsed : Visible; MenuItemSetDeckUrl.Header = string.IsNullOrEmpty(deck.Url) ? LocUtil.Get(LocLink, true) : LocUtil.Get(LocLinkNew, true); MenuItemUpdateDeck.Visibility = string.IsNullOrEmpty(deck.Url) ? Collapsed : Visible; MenuItemOpenUrl.Visibility = string.IsNullOrEmpty(deck.Url) ? Collapsed : Visible; MenuItemArchive.Visibility = DeckPickerList.SelectedDecks.Any(d => !d.Archived) ? Visible : Collapsed; MenuItemUnarchive.Visibility = DeckPickerList.SelectedDecks.Any(d => d.Archived) ? Visible : Collapsed; SeparatorDeck1.Visibility = deck.IsArenaDeck ? Collapsed : Visible; }
private void UpdateUIAfterChangeLanguage() { // Options Helper.OptionsMain.ContentHeader = LocUtil.Get("Options_Tracker_Appearance_Header"); // TrayIcon Core.TrayIcon.MenuItemStartHearthstone.Text = LocUtil.Get("TrayIcon_MenuItemStartHearthstone"); Core.TrayIcon.MenuItemUseNoDeck.Text = LocUtil.Get("TrayIcon_MenuItemUseNoDeck"); Core.TrayIcon.MenuItemAutoSelect.Text = LocUtil.Get("TrayIcon_MenuItemAutoSelect"); Core.TrayIcon.MenuItemClassCardsFirst.Text = LocUtil.Get("TrayIcon_MenuItemClassCardsFirst"); Core.TrayIcon.MenuItemShow.Text = LocUtil.Get("TrayIcon_MenuItemShow"); Core.TrayIcon.MenuItemExit.Text = LocUtil.Get("TrayIcon_MenuItemExit"); // My Games Panel Core.MainWindow.DeckCharts.ReloadUI(); // Deck Picker Core.MainWindow.DeckPickerList.ReloadUI(); }
private static void HandlerTick() { var files = Directory.GetFiles(LanguagesPath); if (CurrentLanguageId < files.Length) { var temp = files[CurrentLanguageId]; var splitpath = temp.Split('\\'); var file = splitpath[splitpath.Length - 1]; var splitfile = file.Split('.'); var infivechars = splitfile[1]; // HelloWindow. en-US .xaml LocUtil.SwitchLanguageAppAll(infivechars); CurrentLanguageId++; } else { CurrentLanguageId = 0; } }
public MainWindowFinal() { InitializeComponent(); InitializeUI(); LocUtil.SetDefaultLanguage(this); // Adjust checked language menu item foreach (MenuItem item in menuItemLanguages.Items) { if (item.Tag.ToString().Equals(LocUtil.GetCurrentCultureName(this))) { item.IsChecked = true; } } }
public static List <ConversationItem> GetConversationItems(string characterID, string conversationKey) { StringBuilder sb = new StringBuilder(); string key = characterID + "/" + conversationKey; var translationList = LocalizationManager.GetTermsList(key); if (GameManager.Instance.IsVampire(characterID)) { var altList = LocalizationManager.GetTermsList(key + "/v"); if (altList != null && altList.Count > 0) { translationList = altList; } } if (translationList == null) { Debug.LogError($"Conversation '{key}' is missing!"); return(new List <ConversationItem>()); } for (int i = 0; i < translationList.Count; i++) { sb.Append($"{LocUtil.TranslateWithDefault("", "params", false, translationList[i])}`{LocUtil.TranslateWithDefault("", "dialogue", false, translationList[i])}`"); for (int j = 1; j < 4; j++) { if (j > 1) { sb.Append("|"); } sb.Append($"{LocUtil.TranslateWithDefault("", "response_" + j + "_link", false, translationList[i])}={LocUtil.TranslateWithDefault("", "response_" + j, false, translationList[i])}"); } sb.Append("\t"); } if (sb.Length > 0) { return(Instance.Parse(sb.ToString())); } return(new List <ConversationItem>()); }
internal async void ImportFromClipboard() { if (_clipboardImportingInProgress) { return; } _clipboardImportingInProgress = true; var deck = await ClipboardImporter.Import(); if (deck == null) { const string dialogTitle = "MainWindow_Import_Dialog_NoDeckFound_Title"; const string dialogText = "MainWindow_Import_Dialog_NoDeckFound_Text"; MessageDialogs.ShowMessage(this, LocUtil.Get(dialogTitle), LocUtil.Get(dialogText)).Forget(); _clipboardImportingInProgress = false; return; } await ShowImportingChoice(deck); _clipboardImportingInProgress = false; }
private void GoRotate(int id) { byte[] cmd = { 0xFA, 0xAF, (byte)id, 1, 0, 0, 0, 0, 0, 0xED }; if (string.IsNullOrWhiteSpace(txtRotateSpeed.Text)) { AppendLog(LocUtil.FindResource("ubt.msgGoRotateParameter")); return; } try { int iDirection = cboRotateDirection.SelectedIndex; int iSpeed = UTIL.GetInputInteger(txtRotateSpeed.Text); if (iSpeed > 2000) { AppendLog(LocUtil.FindResource("ubt.msgGoRotateSpeed")); return; } cmd[4] = (byte)(iDirection == 0 ? 0xFD : 0xFE); cmd[6] = (byte)(iSpeed >> 8 & 0xFF); cmd[7] = (byte)(iSpeed & 0xFF); SendCommand(cmd, 1); if ((id > 0) && (robot.Available == 1)) { byte[] buffer = robot.ReadAll(); string action = (iSpeed == 0 ? LocUtil.FindResource("msgStop") : LocUtil.FindResource("ubt.msgStart")); if (buffer[0] == (0xAA + id)) { AppendLog(String.Format(LocUtil.FindResource("ubt.msgGoRotateSuccess"), id, action)); } else { AppendLog(String.Format(LocUtil.FindResource("ubt.msgGoRotateFail"), id, action)); } } } catch (Exception ex) { AppendLog("\nERR: " + ex.Message); } }
private void GetAdjAngle(int id) { UInt16 adjValue; byte[] buffer; if (!UBTGetAdjAngle(id, out adjValue, out buffer)) { return; } if (id == 0) { return; } string adjMsg = ""; if (adjValue == 0) { adjMsg = LocUtil.FindResource("ubt.msgNoAdjust"); sliderAdjValue.Value = 0; } else if ((adjValue >= 0x0000) && (adjValue <= 0x0130)) { adjMsg = string.Format(LocUtil.FindResource("ubt.msgPosAdjust"), adjValue); sliderAdjValue.Value = adjValue; } else if ((adjValue >= 0xFED0) && (adjValue <= 0xFFFF)) { adjMsg = string.Format(LocUtil.FindResource("ubt.msgNegAdjust"), (65536 - adjValue)); sliderAdjValue.Value = (adjValue - 65536); } else { adjMsg = LocUtil.FindResource("ubt.msgInvalidAdjust"); } string result = String.Format(LocUtil.FindResource("ubt.msgShowAdjust"), buffer[4], buffer[5], buffer[6], buffer[7], adjMsg); AppendLog(result); }
internal void UpdateOpponentDeadForTurns(List <int> turns) { var index = _game.BattlegroundsHeroCount() - 1; foreach (var text in _leaderboardDeadForText) { text.Text = ""; } foreach (var text in _leaderboardDeadForTurnText) { text.Text = ""; } foreach (var turn in turns) { if (index < _leaderboardDeadForText.Count && index < _leaderboardDeadForTurnText.Count && index >= 0) { _leaderboardDeadForText[index].Text = $"{turn}"; _leaderboardDeadForTurnText[index].Text = turn == 1 ? LocUtil.Get("Overlay_Battlegrounds_Dead_For_Turn") : LocUtil.Get("Overlay_Battlegrounds_Dead_For_Turns"); } index--; } }
internal void UpdateOpponentDeadForTurns(List <int> turns) { var index = _game.Entities.Values.Where(x => x.IsHero && x.Info.Turn == 0 && BattlegroundsHeroRegex.IsMatch(x.CardId) && !x.Info.Discarded).Count() - 1; foreach (var text in _leaderboardDeadForText) { text.Text = ""; } foreach (var text in _leaderboardDeadForTurnText) { text.Text = ""; } foreach (var turn in turns) { if (index < _leaderboardDeadForText.Count && index < _leaderboardDeadForTurnText.Count && index >= 0) { _leaderboardDeadForText[index].Text = $"{turn}"; _leaderboardDeadForTurnText[index].Text = turn == 1 ? LocUtil.Get("Overlay_Battlegrounds_Dead_For_Turn") : LocUtil.Get("Overlay_Battlegrounds_Dead_For_Turns"); } index--; } }
private void SetVersion() { if (robot.isConnected) { string version = GetVersion(); if (version == "") { lblVersion.Content = LocUtil.FindResource("cb.msgControllerNotFound"); lblVersion.Foreground = new SolidColorBrush(Colors.Red); } else { lblVersion.Content = version; lblVersion.Foreground = new SolidColorBrush(Colors.Blue); } } else { lblVersion.Content = LocUtil.FindResource("cb.msgPleaseConnectController"); lblVersion.Foreground = new SolidColorBrush(Colors.LightGray); } }
private void sliderAdjValue_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { int n = (int)((Slider)sender).Value; if (n == 0) { txtAdjMsg.Text = String.Format(LocUtil.FindResource("ubt.msgNoAdjust")); } else if (n > 0) { txtAdjMsg.Text = String.Format(LocUtil.FindResource("ubt.msgPosAdjust"), n); } else { txtAdjMsg.Text = String.Format(LocUtil.FindResource("ubt.msgNegAdjust"), -n); } if (n < 0) { n += 65536; } txtAdjAngle.Text = n.ToString("X4"); }
internal async void ShowDeleteDecksMessage(IEnumerable <Deck> decks) { if (decks == null) { return; } var decksList = decks.ToList(); if (!decksList.Any()) { return; } var settings = new MessageDialogs.Settings { AffirmativeButtonText = LocUtil.Get(nameof(Strings.Enum_YesNo_Yes)), NegativeButtonText = LocUtil.Get(nameof(Strings.Enum_YesNo_No)) }; var keepStatsInfo = Config.Instance.KeepStatsWhenDeletingDeck ? "The stats will be kept (can be changed in options)" : "The stats will be deleted (can be changed in options)"; var result = await this.ShowMessageAsync("Deleting " + (decksList.Count == 1 ? decksList.First().Name : decksList.Count + " decks"), "Are you Sure?\n" + keepStatsInfo, MessageDialogStyle.AffirmativeAndNegative, settings); if (result == MessageDialogResult.Negative) { return; } foreach (var deck in decksList) { DeleteDeck(deck, false); } DeckStatsList.Save(); DeckList.Save(); DeckPickerList.UpdateDecks(); DeckPickerList.UpdateArchivedClassVisibility(); DeckManagerEvents.OnDeckDeleted.Execute(decksList); }
private async void UpdateMissingCards() { if (Deck == null || _updatingCollection) { return; } _updatingCollection = true; var collection = await CollectionHelper.GetCollection(); if (!collection?.Any() ?? true) { _updatingCollection = false; return; } var missingCards = new List <DustCostViewModel>(); foreach (var card in Deck.Cards) { collection.TryGetValue(card.Id, out var count); var missingCount = card.Count - count; if (missingCount > 0) { var missing = (Card)card.Clone(); missing.Count = missingCount; missingCards.Add(new DustCostViewModel(missing)); } } MissingCards = missingCards; Helper.SortCardCollection(MissingCards, false); HasMissingCards = missingCards.Any(); TotalDustCost = missingCards.Sum(x => x.DustCost); RequiresKarazhan = missingCards.Any(c => c.Card.CardSet == CardSet.KARA); var missingCardsCount = missingCards.Sum(c => c.Card.Count); MissingCardsHeader = LocUtil.Get(LocMissingCardsHeader) + $" ({missingCardsCount})"; HasCollectionData = true; _updatingCollection = false; }