Пример #1
0
        private void LoadDataForBankTable()
        {
            BankListBox.Invoke(new MethodInvoker(delegate {
                BankListBox.Items.Clear();
            }));

            DisplayedBankItems = RetreaveXMLPendingSubmissions();

            if (m_SelectedBankTab < m_Bank.BankTabs.Count)
            {
                if (m_Bank.BankTabs[m_SelectedBankTab].ItemsDictionary == null)
                {
                    return;
                }

                int count = m_Bank.BankTabs[m_SelectedBankTab].ItemsDictionary.Count;

                foreach (Item item in m_Bank.BankTabs[m_SelectedBankTab].ItemsDictionary.Values)
                {
                    DisplayedBankItems.Add(item);
                }
            }

            int row = 0;

            foreach (Item item in DisplayedBankItems)
            {
                BankListBox.Invoke(new MethodInvoker(delegate {
                    BankListBox.Items.Add(item.StackSize + "\t::\t" + item.Name);
                }));

                row++;
            }
        }
Пример #2
0
 private void UpdateDataForBankTable(object sender, System.Timers.ElapsedEventArgs e)
 {
     LoadDataForBankList(true);
     BankListBox.Invoke(new MethodInvoker(delegate {
         BankListBox.Invalidate();
     }));
 }
Пример #3
0
        async public void LoadDataForBankList(bool UpdateTable = false)
        {
            HttpClient client = new HttpClient();
            string     path   = "https://localhost:44320//api";

            path += "//Bank//" + Convert.ToInt32(User.Instance.Rank);
            string retsz = "";

            try
            {
                retsz = await client.GetStringAsync(path);
            }
            catch
            {
                MessageBox.Show("There was an issue, Try again later.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var bank = JsonConvert.DeserializeObject <Bank>(retsz);

            m_Bank = bank;

            int count = m_Bank.BankTabs.Count;

            TabComboBox.Invoke(new MethodInvoker(delegate {
                TabComboBox.Items.Clear();
            }));
            for (int index = 0; index < count; index++)
            {
                string name = m_Bank.BankTabs[index].Name;
                if (name == "Tab")
                {
                    name += " " + index.ToString();
                }

                TabComboBox.Invoke(new MethodInvoker(delegate {
                    TabComboBox.Items.Add(name);
                }));
            }
            TabComboBox.Invoke(new MethodInvoker(delegate {
                TabComboBox.SelectedIndex = 0;
            }));

            LoadDataForItem(m_Bank.BankTabs[0].ItemsDictionary.First().Value.ItemID);

            BankListBox.Invoke(new MethodInvoker(delegate {
                BankListBox.SelectedIndex = 0;
            }));

            if (UpdateTable)
            {
                LoadDataForBankTable();
            }
        }