/// <summary> /// 停止模拟事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { CreateRealTimeData create = CreateRealTimeData.getCreateRealTimeData(); create.Stop(); textBox1.Text += "stop\r\n"; }
/// <summary> /// 开始模拟按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { CreateRealTimeData create = CreateRealTimeData.getCreateRealTimeData(); create.refreshtxt = (arg) => { this.Invoke(new Action(() => { textBox1.Text += arg + "\r\n"; })); }; create.Start(); textBox1.Text = "start\r\n"; }