/// <summary> /// 遍历A轨产品参数文件夹获取产品名称 /// </summary> public void ErgodicAProduct() { if (cobAProductName.InvokeRequired) { ErgodicAProductDelegate fc = new ErgodicAProductDelegate(ErgodicAProduct); this.Invoke(fc); } else { string path = Application.StartupPath + @"\Config\A"; //产品参数保存路径 var files = Directory.GetFiles(path, "*.ini"); //获取产品路径下所有ini文件名称 cobAProductName.Items.Clear(); cobAProductName.Items.Add("未选择产品"); string temp; for (int i = 0; i < files.Length; i++) { temp = files[i].Substring(path.Length, files[i].Length - path.Length).Trim('\\'); cobAProductName.Items.Add(temp.Substring(0, temp.Length - 4)); } if (cobAProductName.Items.IndexOf(Global.AProductName) != -1)//判断集合中有无当前产品 { cobAProductName.SelectedIndex = cobAProductName.Items.IndexOf(Global.AProductName); } else { cobAProductName.SelectedIndex = 0; } } }
private void tsbtnAutoRun_Click(object sender, EventArgs e) //自动运行界面 { Common.myLog.writeOperateContent("进入自动运行界面", Global.UserPermission, Global.UserPermission); MainMenuBarBtnRGB(0); FrmAutoRun frmAutoRun = new FrmAutoRun(); ErgodicAProductDel += frmAutoRun.ErgodicAProduct; ErgodicBProductDel += frmAutoRun.ErgodicBProduct; ChangeWindow(frmAutoRun, "FrmAutoRun", false); }
private void FrmMain_Load(object sender, EventArgs e) { #region 初始化主界面 MainMenuBarBtnRGB(0); FrmAutoRun frmAutoRun = new FrmAutoRun(); ErgodicAProductDel += frmAutoRun.ErgodicAProduct; ErgodicBProductDel += frmAutoRun.ErgodicBProduct; ChangeWindow(frmAutoRun, "FrmAutoRun", true); //禁用按钮 SetControlEnabled(this.btnAgingTest, false); this.btnAgingTest.ForeColor = Color.Gray; #endregion #region 连接PLC,成功则开始刷新IO ConnectToPLC(); #endregion #region 初始化机器人SDK显示状态与事件绑定 Task.Run(() => { if (Global.RobotReady) { FrmIniRobot.RobotSpel.EventReceived += new Spel.EventReceivedEventHandler(RobotSpel_EventReceived); //机器人事件 Global.DownloadRobotPoint(); Invoke(new Action(() => //成功初始化后状态栏显示 { tslbRobot.Text = "已连接"; tslbRobot.BackColor = Color.Lime; //读取机器人交互信号 IO.RobotReceiveStart = true; IO.ReadRobotStatus(); })); } else { Invoke(new Action(() => //初始化失败更新状态栏 { tslbRobot.Text = "未连接"; tslbRobot.BackColor = Color.Red; })); } }); #endregion #region 状态栏刷新 StatusTools(); #endregion }