/// <summary> /// Select the "preferred" print using <see cref="ArtworkPreferences"/>. /// </summary> private async void LoadPrints(Card card) { IsPopulatingPrints = true; List <Card> prints = await ScryfallService.GetAllPrintingsAsync(card, Reporter); if (IsFront) { var prices = new List <double>(); foreach (Card print in prints) { if (double.TryParse(print.Prices?.Usd, out double valAsDouble)) { prices.Add(valAsDouble); } } LowestPrice = prices.Any() ? prices.Min() : 0; } else { LowestPrice = 0; } var indexCounter = 0; foreach (Card print in prints) { if (card.Id == print.Id) { SelectedPrintingIndex = indexCounter; } AllPrintings.Add(print); indexCounter++; } if (!AllPrintings.Any()) { AllPrintings.Add(card); } IsPopulatingPrints = false; SelectedPrinting = AllPrintings[SelectedPrintingIndex]; }
private void DefaultOnSettingsSaving(object sender, CancelEventArgs e) { Card card = SelectedPrinting ?? AllPrintings.FirstOrDefault(); if (card == null) { return; } if (card.IsToken) { IsLegal = true; } else { PropertyInfo specificFormatPropInfo = card.Legalities.GetType().GetProperty(Settings.Default.SavedFormat.ToString()) ?? throw new ArgumentOutOfRangeException(nameof(Settings.Default.SavedFormat)); IsLegal = specificFormatPropInfo.GetValue(card.Legalities).ToString() == "legal"; } }