Пример #1
0
        private void labelExecStatus_Click(object sender, EventArgs e)
        {
            try
            {
                if (ctl.OperatingMode == ControllerOperatingMode.Auto && ctl.State == ControllerState.MotorsOn)
                {
                    Mastership mc = Mastership.Request(this.ctl.Rapid);
                    if (labelExecStatus.Text == ExecutionStatus.Running.ToString())
                    {
                        //Perform operation

                        tasks[0].Stop();
                    }
                    else
                    {
                        StartResult a;
                        tasks[0].ResetProgramPointer();
                        a = tasks[0].Start();
                    }
                    mc.Dispose();
                }
                else
                {
                    MessageBox.Show("Please turn to Auto mode and motor on");
                }
            }
            catch (System.InvalidOperationException ex)
            {
                MessageBox.Show("Mastership is held by another client." + ex.Message);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("Unexpected error occurred: " + ex.Message);
            }
        }
Пример #2
0
 /// <summary>
 /// 判断有没有获得权限
 /// </summary>
 public void JudgeMaster()
 {
     if (m != null)
     {
         if (m.IsMaster)
         {
             m.Dispose();
         }
     }
 }
Пример #3
0
        private void listViewData_DoubleClick(object sender, EventArgs e)
        {
            RapidData rdt  = null;
            string    temp = "0";

            try
            {
                MessageBox.Show("Zero clearing?    accept in the flexpandent after click OK");
                rdt = this.ctl.Rapid.GetTask(taskName).GetModule(moduleName).GetRapidData(listViewData.SelectedItems[0].Text.ToString());
                Mastership mas = Mastership.Request(this.ctl.Rapid);
                //Change: controller is repaced by aController
                rdt.Value = ABB.Robotics.Controllers.RapidDomain.Num.Parse(temp);
                mas.Dispose();
                MessageBox.Show("zero clearing");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Type isn't Num. error: " + ex.ToString());
            }

            //Release mastership as soon as possible
        }
Пример #4
0
 public RobotStatus Stop_Click()
 {
     tasks = this._controller.Rapid.GetTasks();
     if (this._controller.OperatingMode == ControllerOperatingMode.Auto)
     {
         Mastership m = Mastership.Request(this._controller.Rapid);
         tasks[0].Stop(StopMode.Immediate);
         //tasks[0].ExecutionStatus = TaskExecutionStatus.
         m.Dispose();
         return(RobotStatus.finish);
     }
     else
     {
         return(RobotStatus.nonAuto);
         //MessageBox.Show("Automatic mode is required to start execution from a remote client.");
     }
     //try
     //{
     //    tasks = this._controller.Rapid.GetTasks();
     //    if (this._controller.OperatingMode == ControllerOperatingMode.Auto)
     //    {
     //        Mastership m = Mastership.Request(this._controller.Rapid);
     //        tasks[0].Stop(StopMode.Immediate);
     //        m.Dispose();
     //    }
     //    else
     //    {
     //        MessageBox.Show("Automatic mode is required to start execution from a remote client.");
     //    }
     //}
     //catch (System.InvalidOperationException ex)
     //{
     //    MessageBox.Show("Mastership is held by another client. " + ex.Message);
     //}
     //catch (System.Exception ex)
     //{
     //    MessageBox.Show("Unexpected error occurred: " + ex.Message);
     //}
 }