Пример #1
0
        private void buttonExec_Click(object sender, EventArgs e)
        {
            // Progressクラスのインスタンスを作成
            var p = new Progress <MyProgress>(ShowProgress);

            mSync         = new USync();
            textBox3.Text = mSync.Main(textBox1.Text, textBox2.Text, 1, p);
            mSync         = null;
        }
Пример #2
0
        private async void buttonCheck_Click(object sender, EventArgs e)
        {
            mSync = new USync();

            progressBar1.Value = 0;
            labelProgress.Text = "処理中";

            // Progressクラスのインスタンスを作成
            var p = new Progress <MyProgress>(ShowProgress);

            // バックグラウンドで実行
            try
            {
                textBox3.Text = await Task.Run(() => mSync.Main(textBox1.Text, textBox2.Text, 2, p));
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
            mSync = null;
        }