private void FormMain_Load(object sender, EventArgs e) { #region CH if (GlobalData.currentMesSession != null) { DelegateState.MsgView?.Invoke(ColorHelper.MsgOrange, "请选择制令单."); HandleStop(); } else { HandleInit(); } CheckQueue = new Queue <Func <ErrorMessage> >(); CheckQueue.Enqueue(LoadAnimalPic); CheckQueue.Enqueue(GetWorkOrder); DelegateState.CHDriverWorkStateChange = CHDriver_WorkStateChange; DelegateState.NewSessionConnected += NewSessionConnected; DelegateState.SessionClosed += SessionClosed; SFCInterface = new DM_SFCInterface(); ySJMESInterface = new YSJMESInterface(); BackgroundWorker bgw = new BackgroundWorker(); bgw.DoWork += AsyncLoadUIPluguns; bgw.RunWorkerCompleted += AsyncLoadUIPlugunsCompleted; bgw.RunWorkerAsync();//开启异步加载插件模块 #endregion }
private void FormMain_Load(object sender, EventArgs e) { #region main GlobalData.InitGlobalData();//初始化全局数据 Text = string.Format("IA-MES CS端系统 ({0} - {1})", GlobalData.Process, GlobalData.MachineId); CenterImage.Image = Image.FromFile(ExePath + @"Res\Network2.png"); staStripVersion.Text = "版本:" + Assembly.GetExecutingAssembly().GetName().Version.ToString(); cfgHelper = GlobalData.CfgHelper; log = GlobalData.Log; log.OnDisplayLog += OnDisplayLog; #endregion #region CH CheckQueue.Enqueue(CheckConnection); CheckQueue.Enqueue(LoadAnimalPic); CheckQueue.Enqueue(GetWorkOrder); CheckQueue.Enqueue(InitAppServer); dgvList.AutoGenerateColumns = false; SFCInterface = new DM_SFCInterface(); ySJMESInterface = new YSJMESInterface(); DelegateState.CHDriverWorkStateChange = CHDriver_WorkStateChange; DelegateState.NewRequestReceived = ShowMessage; DelegateState.NewSessionConnected = NewSessionConnected; DelegateState.SessionClosed = SessionClosed; BackgroundWorker bgw = new BackgroundWorker(); bgw.DoWork += AsyncLoadUIPluguns; bgw.RunWorkerCompleted += AsyncLoadUIPlugunsCompleted; bgw.RunWorkerAsync();//开启异步加载插件模块 //启动网络连接监测线程 Thread threadPing = new Thread(CheckNetConnection); threadPing.IsBackground = true; threadPing.Priority = ThreadPriority.Lowest; threadPing.Start(GlobalData.MESServerIP); #endregion }