Beispiel #1
0
        private void timer3_Tick_1(object sender, EventArgs e)
        {
            Combobox2CallBack comcalback = delegate()
            {
                try
                {
                    DateTime dt      = DateTime.Now;
                    string   StrTime = dt.ToLongTimeString().ToString();
                    label13.Text = StrTime;
                    DateTime NowTime;
                    DateTime.TryParse(StrTime, out NowTime);
                    DateTime StartTime;
                    DateTime.TryParse(comboBox2.Text, out StartTime);
                    DateTime EndTime;
                    DateTime.TryParse(comboBox3.Text, out EndTime);
                    if (StartTime == NowTime)
                    {
                        timer1.Start();
                    }
                    if (EndTime == NowTime)
                    {
                        timer1.Stop();
                        MessageBox.Show("指令发送完成", "信息提示");
                    }
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message);
                }
            };

            comboBox2.Invoke(comcalback);
        }
Beispiel #2
0
        private void timer2_Tick_1(object sender, EventArgs e)
        {
            Combobox2CallBack comcalback = delegate()
            {
                try
                {
                    DateTime dt = DateTime.Now;
                    DateTime StartTime;
                    DateTime.TryParse(comboBox2.Text, out StartTime);
                    string   StrTime = dt.ToLongTimeString().ToString();
                    DateTime NowTime;
                    DateTime.TryParse(StrTime, out NowTime);
                    textBox1.Text = (NowTime - StartTime).ToString();
                    toolStripStatusLabel1.Text = "发送成功";
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message, "信息提示");
                }
            };

            comboBox2.Invoke(comcalback);
        }