示例#1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //задержка нажатия
            if (DateTime.Now > time)
            {
                time = DateTime.Now.AddSeconds(2);
            }
            else
            {
                return;
            }

            if (FIO.textBox.Text.Length < 3 || INN.textBox.Text.Length < 1 || !Subject.IntCorrect(INN.textBox.Text) || OECVED.textBox.Text.Length < 1 || !Subject.DateCorrect(DATEREGIST.textBox.Text))
            {
                for (int X = 0; X <= 65; X++)
                {
                    var l = Math.Sin(X * 1.1) * Math.Pow(Math.E, -X / 10) * 30;
                    buttonOK.Location = new Point(buttonOK.Location.X + Convert.ToInt32(l), buttonOK.Location.Y);
                    buttonOK.Update();
                    Thread.Sleep(delay);

                    buttonOK.Location = new Point(buttonOK.Location.X - Convert.ToInt32(l), buttonOK.Location.Y);
                    buttonOK.Update();
                }
            }
            else
            {
                mainSubject.Name      = FIO.textBox.Text;
                mainSubject.ITaxNum   = Convert.ToInt32(INN.textBox.Text);
                mainSubject.StartDate = Convert.ToDateTime(DATEREGIST.textBox.Text);
                mainSubject.ActivitiesFromString(OECVED.textBox.Text);
                mainSubject.TaxType = (TaxTypes)TAX.SelectedIndex;

                this.DialogResult = DialogResult.OK;
                this.Dispose();
            }
        }