using Monitor; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Net; using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; namespace centralController { public partial class centralController : Form { public centralController() { InitializeComponent(); if (Monitor.Monitor.ins == null) { Monitor.Monitor.ins = new Monitor.Monitor(flowLayoutPanel1.Handle); Monitor.Monitor.ins.Start(); } //进度条测试 Task.Factory.StartNew(() => { int temp = 0; while (true) { if (temp != Monitor.Monitor.initializeState) { temp = Monitor.Monitor.initializeState; progressBar1.Invoke(new Action(()=> { progressBar1.Value = temp * 20; })); } if (temp == 5) { break; } Thread.Sleep(200); } }); } private void btn_exit_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("确定退出系统吗?", "温馨提示", MessageBoxButtons.OKCancel); if (result.Equals(DialogResult.OK)) { Monitor.Monitor.ins.Stop(); Close(); } } private void button1_Click(object sender, EventArgs e) { string ip = textBox1.Text; IPAddress temp; if (IPAddress.TryParse(ip, out temp)) { string license = ""; Task.Factory.StartNew(() => { license = Monitor.Monitor.numMachineLinker.GetLicensePlate(1); if (textBox2.InvokeRequired) { textBox2.Invoke(new Action(() => { textBox2.Text = license; })); } else { textBox2.Text = license; } }); } } } }