Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        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
        }