void MainFormLoad(object sender, EventArgs e) { SplashForm.Display(Application.ProductName); this.Text = Application.ProductName; tsslMsg.Text = ""; List <string> errorStrs = new List <string>(); //初始化日志记录功能 Globals.MLog = Log4netManager.GetLogger(); Globals.MLog.Info("========== 程序启动 =========="); //初始化用户信息 Globals.CurrentUser = "******"; //初始化运行模式 Globals.CurrentRunMode = Globals.RunMode.ProductionMode; //TODO: 初始化视觉 SplashForm.SetTextAndProgress("正在初始化相机和视觉程序...", 10); string rsStr = Acqs.Init(); if (rsStr != "OK") { string tempStr = "初始化相机错误:" + rsStr; errorStrs.Add(tempStr); Globals.MLog.Error(tempStr); } rsStr = ProductManager.SetProduct(0); //初始化光源控制器 SplashForm.SetTextAndProgress("正在初始化光源控制...", 50); Globals.OPTController = new OPTControllerAPI(); int ret = Globals.OPTController.CreateEtheConnectionByIP(""); if (ret != 0) { string tempStr = "光源控制器连接失败:" + ret; errorStrs.Add(tempStr); Globals.MLog.Error(tempStr); } //初始化PLC连接 SplashForm.SetTextAndProgress("正在初始化PLC连接...", 80); int rsInt = Globals.MXStation1.Open(); if (rsInt != 0) { string tempStr = "PLC连接失败:" + rsInt; errorStrs.Add(tempStr); Globals.MLog.Error(tempStr); } //初始化异常,禁用窗口 //if (errorStrs.Count > 0) //{ // Globals.runStatus = Globals.RunStatus.Alarm; // tsslMsg.Text = errorStrs[0]; // tsslMsg.ForeColor = Color.Red; // MsgBox.Show(string.Join("\r\n", errorStrs), ico: MessageBoxIcon.Error); // panelTitle.Enabled = false; // ShowForm<FrmLog>(btnLog); // return; //} btnHome.PerformClick(); //启动刷新界面timer tUpdateUI.Start(); SplashForm.CloseDisplay(); }
public static void Display(string ProgramName) { splashForm = new SplashForm(); splashForm.lbName.Text = ProgramName; splashForm.Show(); }