コード例 #1
0
        public static int ShowDialog(int text, string caption, int maximum)
        {
            var prompt = new IntegerInput()
            {
                Text = caption
            };

            prompt.amount.Value   = text;
            prompt.amount.Maximum = maximum;

            return(prompt.ShowDialog() == DialogResult.OK ?  (int)prompt.amount.Value : 0);
        }
コード例 #2
0
        void RecycleToolStripMenuItemClick(object sender, EventArgs e)
        {
            var item   = (ItemData)ItemsListView.SelectedItems[0].Tag;
            int amount = IntegerInput.ShowDialog(1, "How many?", item.Count);

            if (amount > 0)
            {
                var resp = RecycleItems(item, amount);
                if (resp)
                {
                    item.Count -= amount;
                    ItemsListView.SelectedItems[0].SubItems[1].Text = "" + item.Count;
                }
                else
                {
                    MessageBox.Show(th.TS(" recycle failed!"), th.TS("Recycle Status"), MessageBoxButtons.OK);
                }
            }
        }
コード例 #3
0
        async void RecycleToolStripMenuItemClick(object sender, EventArgs e)
        {
            var item   = (ItemData)ItemsListView.SelectedItems[0].Tag;
            int amount = IntegerInput.ShowDialog(1, "How many?", item.Count);

            if (amount > 0)
            {
                taskResponse resp = new taskResponse(false, string.Empty);

                resp = await RecycleItems(item, amount);

                if (resp.Status)
                {
                    item.Count -= amount;
                    ItemsListView.SelectedItems[0].SubItems[1].Text = "" + item.Count;
                }
                else
                {
                    MessageBox.Show(resp.Message + " recycle failed!", "Recycle Status", MessageBoxButtons.OK);
                }
            }
        }