Exemplo n.º 1
0
        /// <summary>
        /// 主窗口加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmMain_Load(object sender, EventArgs e)
        {
            try
            {
                this.WindowState = FormWindowState.Maximized;

                var sw = Stopwatch.StartNew();
                //检测端口


                //打开端口
                serialPort7.Open();

                //开始后台进程
                DateTimeThreadHandler = new Common.ThreadHandler(new ThreadStart(DateTimeTimer), true, true);
                //SerialPort1ThreadHandler = new Common.ThreadHandler(new ThreadStart(GetRFIDDataTimer), true, true);

                SerialPort7ThreadHandler = new Common.ThreadHandler(new ThreadStart(SendDataToSerialPortTimer), true, true);

                //label2.Text = DateTimeThreadHandler.ThreadState();

                //MessageBox.Show("初始化共使用" + sw.ElapsedMilliseconds.ToString() + "毫秒");

                //状态
                mc_MachineStatusHander = new Common.MachineStatusHandler();
                mc_MachineStatusHander.ChangeStatus("Online", "运行", "WesChen", "001A");

                sw.Stop();
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex.Message, "系统初始化");
                this.Close();
            }
        }