protected override void UpdateContent()
        {
            AllItems.Clear();
            IList <Item> all_items = FindAllItems(mSearchField, mSearchValue);

            foreach (Item item in all_items)
            {
                AllItems.Add(item);
            }

            SoldItems.Clear();
            IList <Item> sold_items = FindSoldItems(mSearchField, mSearchValue);

            foreach (Item item in sold_items)
            {
                SoldItems.Add(item);
            }

            BoughtItems.Clear();
            IList <Item> bought_items = FindBoughtItems(mSearchField, mSearchValue);

            foreach (Item item in bought_items)
            {
                BoughtItems.Add(item);
            }

            InventoriedItems.Clear();
            IList <Item> inventoried_items = FindInventoriedItems(mSearchField, mSearchValue);

            foreach (Item item in inventoried_items)
            {
                InventoriedItems.Add(item);
            }
        }
 public ItemsWindow(List <Item> items)
 {
     InitializeComponent();
     DataContext          = this;
     MyCustomMessageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(1000));
     itemsSource          = new ObservableCollection <Item>(items);
     Items = new ObservableCollection <Item>(items);
     for (int i = 0; i < 9; i++)
     {
         BoughtItems.Add(emptyItem);
     }
 }
        private void RemoveBoughtItem(object sender, MouseEventArgs e)
        {
            Image itemImage    = (Image)sender;
            Item  itemToRemove = (Item)itemImage.DataContext;

            if (itemToRemove != emptyItem)
            {
                BoughtItems.Remove(itemToRemove);
                BoughtItems.Add(emptyItem);
                boughtItemCount--;
                calculateRemainingPrice();
            }
        }
示例#4
0
    public static void AddEntry(string name)
    {
        BoughtItemEntry ie = new BoughtItemEntry {
            name = name
        };

        string path       = Application.dataPath + "/Data/BoughtItems.json";
        string jsonString = File.ReadAllText(path);

        BoughtItems i = JsonUtility.FromJson <BoughtItems>(jsonString);

        i.bought_entry_list.Add(ie);

        string json = JsonUtility.ToJson(i);

        File.WriteAllText(path, json);
        bought = true;
    }
示例#5
0
    public static void RemoveEntryByName(string name)
    {
        string path       = Application.dataPath + "/Data/BoughtItems.json";
        string jsonString = File.ReadAllText(path);

        BoughtItems it = JsonUtility.FromJson <BoughtItems>(jsonString);

        for (int i = 0; i < it.bought_entry_list.Count; i++)
        {
            if (it.bought_entry_list[i].name == name)
            {
                it.bought_entry_list.Remove(it.bought_entry_list[i]);
            }
        }

        string json = JsonUtility.ToJson(it);

        File.WriteAllText(path, json);
    }