//Handle selections.
        //If one item is selected, it is placed to "selectedItem" variable and "selectedItems" is null.
        //If multiple items are selected, those are placed to "selectedItems" variable as List<Material> and "selectedItem" is null.
        //If all items are deselected both variables are null.
        private void InventoryItemList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if ((sender as ListView).SelectedItems.Count > 1)
            {
                this.selectedItem = null;

                var tempList = new List<Material>();
                foreach (var item in (sender as ListView).SelectedItems)
                {
                    tempList.Add(item as Material);
                }
                this.selectedItems = tempList;
            }
            else if ((sender as ListView).SelectedItem != null)
            {
                this.selectedItem = ((sender as ListView).SelectedItem as Material);
                this.selectedItems = null;
            }
            else
            {
                this.selectedItem = null;
                this.selectedItems = null;
            }

            UpdateInventoryItemPanel();
        }
 public void AddToList(Material material)
 {
     if (material != null)
     {
         bool add = false;
         for (int i = 0; i < content.Count; i++)
         {
             if (content[i].Name == material.Name)
             {
                 content[i].Quantity += material.Quantity;
                 add = true;
             }
         }
         if(!add)
             content.Add(material);
     }
 }
 public void RemoveFromList(Material material)
 {
     content.Remove(material);
 }