Exemplo n.º 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);
     }
 }
Exemplo n.º 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");
        }
Exemplo n.º 3
0
        private static void UpdateToFullItem(ref ItemSummary item)
        {
            if (item == null)
            {
                return;
            }

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