Esempio n. 1
0
 private void SetupSpoilsBagInventoryClicked()
 {
     foreach (var children in SpoilsBagInventory.Children)
     {
         Label element = (Label)children;
         element.MouseLeftButtonUp += (sender, e) =>
         {
             string          index           = element.Tag.ToString();
             int             quantity        = _windWaker.GetSpoilsBagInventoryItemQty(index);
             InventoryDialog inventoryDialog = new InventoryDialog(element.Content.ToString(), quantity, true)
             {
                 Owner = this
             };
             if (inventoryDialog.ShowDialog() != true)
             {
                 return;
             }
             var result = inventoryDialog.GetResult();
             _windWaker.UpdateSpoilsBagInventoryItem(index, result.ItemId);
             if (result.ItemQuantity != -1)
             {
                 _windWaker.UpdateSpoilsBagInventoryItemQty(index, result.ItemQuantity);
             }
         };
     }
 }
Esempio n. 2
0
 private void SetupInventoryClicked()
 {
     foreach (var children in GridInventory.Children)
     {
         Border element = (Border)children;
         element.MouseLeftButtonUp += (sender, e) =>
         {
             int             inventoryId     = int.Parse(new Regex(@"\d+").Match(element.Name).Value);
             Item?           currentItem     = GameItems.GetItemById(_windWaker.GetInventoryItem(inventoryId));
             InventoryDialog inventoryDialog = new InventoryDialog(currentItem.HasValue ? currentItem.Value.Name : "")
             {
                 Owner = this
             };
             if (inventoryDialog.ShowDialog() == true)
             {
                 _windWaker.UpdateInventoryItem(inventoryId, inventoryDialog.GetResult().ItemId);
             }
         };
     }
 }