private async void OnButtonTestClick(object sender, EventArgs e)
        {
            try
            {
                //var x = 5.5;
                //var y = 7.6;

                //A.Swap<double>(ref x, ref y);

                //var p = $"Значение x={5} значение y={7}";

                //Debug.WriteLine($@"x={x}, y={y}");

                //var str = "123fff";
                //int a;
                //a = int.Parse(str);
                //{
                //	Debug.WriteLine("OK");
                //}

                var progress = new Progress <ProgressArgs>();

                using (var progressForm = new ProgressForm(progress))
                {
                    progressForm.Show(this);
                    await TestAsyncProgressMethods.TestProgress(progress);

                    progressForm.Close();
                }

                //using(var dialogForm = new DialogFormTest1())
                //{
                //	switch(dialogForm.ShowDialog(this))
                //	{
                //		case DialogResult.OK:
                //			{

                //				break;
                //			}
                //		default:
                //		case DialogResult.Cancel:
                //			{
                //				break;
                //			}
                //	}
                //}
            }
            catch (Exception exc)
            {
                MessageBox.Show(this, exc.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void OnButtonProgressBar(object sender, EventArgs e)
        {
            var progress = new Progress <ProgressArgs>();

            using (var progressForm = new ProgressForm(progress))
            {
                progressForm.Shown += async(_1, _2) =>
                {
                    await TestAsyncProgressMethods.TestProgress(progress);

                    progressForm.Close();
                };

                switch (progressForm.ShowDialog(this))
                {
                default:
                case DialogResult.Cancel:
                {
                    break;
                }
                }
            }
        }