Ejemplo n.º 1
0
        private async void button1_Click(object sender, System.EventArgs e)
        {
            int sage      = checkBox1.Checked ? 1 : 0;
            int anonymous = checkBox2.Checked ? 1 : 0;
            var result    = await mApi.SendMonaAsync(mTopic.Id, mResponseId, (ulong)(numericUpDown1.Value * 100000000), anonymous, textBox3.Text, sage);

            if (result != null)
            {
                if (result.Status == 0)
                {
                    MessageBox.Show(result.Error, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("送金に成功しました", "通知", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    mParent.UpdateConnectionStatus("通信中");
                    if (!(await mParent.ReloadResponse()))
                    {
                        mParent.UpdateConnectionStatus("受信失敗");
                    }
                }
            }
            else
            {
                MessageBox.Show("送金に失敗しました", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            this.Close();
        }
Ejemplo n.º 2
0
        private async void button1_Click(object sender, EventArgs e)
        {
            bool flag         = true;
            int  sage         = checkBox1.Checked ? 1 : 0;
            int  anonymous    = checkBox2.Checked ? 1 : 0;
            var  target       = (ulong)(numericUpDown4.Value * 100000000);
            var  watanabe     = (ulong)(numericUpDown1.Value * 100000000);
            var  responseList = FilterResponseList(mResponseList.Responses);

            mIsScattering   = true;
            button1.Enabled = false;
            toolStripProgressBar1.Maximum = responseList.Count();

            foreach (var response in responseList)
            {
                ulong value = watanabe;
                if (checkBox5.Checked)
                {
                    var receive = ulong.Parse(response.Receive);
                    if (receive < target)
                    {
                        value = target - receive;
                    }
                }

                if (value == 0)
                {
                    continue;
                }

                await Task.Run(() => System.Threading.Thread.Sleep(100));

                var result = await mApi.SendMonaAsync(mTopic.Id, response.Id, value, anonymous, textBox3.Text, sage);

                if (result != null)
                {
                    if (result.Status == 0)
                    {
                        MessageBox.Show(result.Error, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        flag = false;
                        break;
                    }
                    else
                    {
                        toolStripProgressBar1.Value++;
                    }
                }
                else
                {
                    MessageBox.Show("送金に失敗しました", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    flag = false;
                    break;
                }
            }
            if (flag)
            {
                MessageBox.Show("送金に成功しました", "通知", MessageBoxButtons.OK, MessageBoxIcon.Information);
                mParent.UpdateConnectionStatus("通信中");
                if (!(await mParent.ReloadResponse()))
                {
                    mParent.UpdateConnectionStatus("受信失敗");
                }
            }

            this.Close();
        }