예제 #1
0
 private static void SelectActiveGem(ComboBox comboBox, IEnumerable<GemsListViewItem> refGems, ItemSummary equippedGem)
 {
     if (equippedGem != null)
     {
         comboBox.SelectedItem = refGems.FirstOrDefault(g => equippedGem.Id == g.Item.Id);
     }
 }
예제 #2
0
        /// <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");
        }
예제 #3
0
        private static void UpdateToFullItem(ref ItemSummary item)
        {
            if (item == null)
            {
                return;
            }

            item = item.GetFullItem();
        }
예제 #4
0
 private void UpdateItemPicture(ItemSummary item)
 {
     D3Api.GetItemIcon(item.Icon, "large",
         picture =>
         {
             if (picture != null)
             {
                 guiItemPicture.Image = new Bitmap(new MemoryStream(picture.Bytes));
             }
         },
         () => { }
         );
 }
예제 #5
0
        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;
        }
예제 #6
0
 /// <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);
 }
예제 #7
0
 /// <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);
 }
예제 #8
0
 private void OnNodeClick(ItemSummary d3Object)
 {
     D3ObjectLiveUrl.Text = D3Api.GetItemUrlFromTooltipParams(d3Object.TooltipParams);
 }
예제 #9
0
 private static void UpdateNodeText(TreeNode node, ItemSummary d3Object)
 {
     node.Text += $" >> {d3Object.Name}";
 }
예제 #10
0
 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;
        }
예제 #12
0
        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();
                    }));
                },
                () => { }
                );
        }