/// <summary> /// 停止模拟按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { CreateWeatherData create = CreateWeatherData.getCreateWeatherData(); 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) { CreateWeatherData create = CreateWeatherData.getCreateWeatherData(); create.refreshtxt = (arg) => { this.Invoke(new Action(() => { textBox1.Text += arg + "\r\n"; })); }; create.Start(); textBox1.Text = "start\r\n"; }