private void ItemTextbox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (sender is ComboBox cb) { if (cb.SelectedItem is En thisSelection) { BackgroundWorker bw = new BackgroundWorker { WorkerReportsProgress = true }; bw.DoWork += delegate { _selectedItem = FNA.GetFilePair(thisSelection.UrlName); }; bw.RunWorkerAsync(); bw.RunWorkerCompleted += (o, args) => { if (_selectedItem.ItemHasRanks) { ShowRankSelector(); } else { HideRankSelector(); } Image_Item.MouseUp -= ClickImage; Image_Item.Source = new BitmapImage(new Uri(Path.Combine(Functions.PathToTemp(), Path.GetFileName(_selectedItem.FileName)))); Image_Item.MouseUp += ClickImage; }; } } }
public ItemNotification(PostLoad postLoad) { PostLoad = postLoad; OnlineIconUrl = Path.Combine(Functions.PathToTemp(), Path.GetFileName(FNA.GetFilePair(postLoad.Item.UrlName).FileName)); FullName = _postLoad.Item.Name; UrlName = _postLoad.Item.UrlName; Quantity += $"[{postLoad.Quantity}]"; OfferText = $"{postLoad.Platinum} Platinum"; if (postLoad.Quantity > 1) { OfferText += $" Each ({postLoad.Quantity * postLoad.Platinum})"; } switch (_postLoad.Type) { case OrderType.Buy: OfferForeground = Constants.WtbForeground; OfferBackground = Constants.WtbBackground; break; case OrderType.Sell: OfferForeground = Constants.WtsForeground; OfferBackground = Constants.WtsBackground; break; } switch (_postLoad.User.Status) { case Status.Ingame: UserStatus = "ONLINE IN GAME"; StatusForeground = Constants.StatusForegroundIngame; break; case Status.Offline: UserStatus = "OFFLINE"; StatusForeground = Constants.StatusForegroundOffline; break; case Status.Online: UserStatus = "ONLINE"; StatusForeground = Constants.StatusForegroundOnline; break; } }
private GridItem LoadFromConfiguration(C.Item i) { var g = new GridItem { Name = i.Name, Price = i.Price, Type = i.Type, Enabled = i.Enabled, Image = Path.Combine(Functions.PathToTemp(), Path.GetFileName(FNA.GetFilePair(i.UrlName).FileName)) }; if (i.QuantityMin == 0 && i.QuantityMax != 999) { g.Quantity = $"≤ {i.QuantityMax}"; } else if (i.QuantityMin != 0 && i.QuantityMax == 999) { g.Quantity = $"≥ {i.QuantityMin}"; } else if (i.QuantityMin == 0 && i.QuantityMax == 999) { g.Quantity = "ANY"; } else { g.Quantity = $"{i.QuantityMin} - {i.QuantityMax}"; } if (i.ModRankMin != null && i.ModRankMax != null) { g.Rank = i.ModRankMax == i.ModRankMin ? $"{i.ModRankMin}" : $"{i.ModRankMin} - {i.ModRankMax}"; } else if (i.ModRankMin != null && i.ModRankMax == null) { g.Rank = $"{i.ModRankMin} +"; } else if (i.ModRankMin == null && i.ModRankMax != null) { g.Rank = $"- {i.ModRankMax}"; } else { g.Rank = "N/A"; } switch (i.Type) { case OrderType.Buy: g.OrderText = "WTB"; g.OrderForeground = Constants.WtbForeground; g.OrderBackground = Constants.WtbBackground; break; case OrderType.Sell: g.OrderText = "WTS"; g.OrderForeground = Constants.WtsForeground; g.OrderBackground = Constants.WtsBackground; break; } g.Configitem = i; return(g); }