private static void SelectActiveGem(ComboBox comboBox, IEnumerable<GemsListViewItem> refGems, ItemSummary equippedGem) { if (equippedGem != null) { comboBox.SelectedItem = refGems.FirstOrDefault(g => equippedGem.Id == g.Item.Id); } }
/// <summary> /// Fetches the icon of a given item. /// </summary> /// <param name="item"></param> /// <returns></returns> private static D3Picture FetchIconOf(ItemSummary item) { if (item == null || item.Icon == null) { return null; } return D3Api.GetItemIcon(item.Icon, "large"); }
private static void UpdateToFullItem(ref ItemSummary item) { if (item == null) { return; } item = item.GetFullItem(); }
private void UpdateItemPicture(ItemSummary item) { D3Api.GetItemIcon(item.Icon, "large", picture => { if (picture != null) { guiItemPicture.Image = new Bitmap(new MemoryStream(picture.Bytes)); } }, () => { } ); }
private static async Task<Item> GetFullItem(ItemSummary itemSummary, string itemName) { if (itemSummary == null) { return null; } Console.WriteLine($"Downloading {itemName}"); var itemAsync = await itemSummary?.GetFullItemAsync(); Console.WriteLine($"{itemName} downloaded"); return itemAsync; }
/// <summary> /// Creates a new instance by copying fields of <paramref name="itemSummary"/> (deep copy). /// </summary> /// <param name="itemSummary"></param> public ItemSummary(ItemSummary itemSummary) { itemSummary.DeepCopy(this); }
private void OnNodeClick(ItemSummary d3Object) { D3ObjectLiveUrl.Text = D3Api.GetItemUrlFromTooltipParams(d3Object.TooltipParams); }
private static void UpdateNodeText(TreeNode node, ItemSummary d3Object) { node.Text += $" >> {d3Object.Name}"; }
private void InsertContextMenu(TreeNode node, ItemSummary d3Object) { node.Tag = d3Object; node.ContextMenuStrip = guiItemSummaryContextMenu; node.NodeFont = defaultNodeFont; }
private View CreateSocketRowView(List<string> labels, List<Item> gems, ItemSummary selected) { var rowView = CreateSocketRowView(labels, gems); var index = 0; for (; index < gems.Count; index++) { if (gems[index].Id == selected.Id) { break; } } if (index != gems.Count) { // Note: spinner has the additional "no gem" choice rowView.FindViewById<Spinner>(Resource.Id.socketLabel) .SetSelection(index + 1); } return rowView; }
private void AddItem(ItemSummary itemSummary) { if (itemSummary == null) { return; } itemSummary.GetFullItem( item => { if (item == null) { return; } var control = new D3ItemControl(item); guiItemsPanel.Invoke(new MethodInvoker(() => { SuspendLayout(); guiItemsPanel.Controls.Add(control); ResumeLayout(); })); }, () => { } ); }