コード例 #1
0
 private void 机器人坐标ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.dataGridView1.SelectedRows.Count == 1)
     {
         Task.Run(() => {
             var robot = new TsRemoteS();
             robot.SetIPaddr(0, this.IpAddress, this.Port);
             robot.Connect(1);
             TsPointS p         = robot.GetPsnFbkWorld();
             DataGridViewRow dr = this.dataGridView1.SelectedRows.OfType <DataGridViewRow>().Single();
             this.CalData.Rows[dr.Index]["x"] = p.X;
             this.CalData.Rows[dr.Index]["y"] = p.Y;
             this.CalData.Rows[dr.Index]["z"] = p.Z;
             Task.Run(() => {
                 robot.Disconnect();
                 robot.Dispose();
             });
         });
     }
 }
コード例 #2
0
 public bool disConnect()
 {
     //已經關閉,直接回傳
     if ((ConnectStatus & CONNECTTYPE.CONNECTED) == 0)
     {
         return(true);
     }
     try
     {
         //P.34
         if (_Robot.Disconnect() == true)
         {
             ConnectStatus &= ~CONNECTTYPE.CONNECTED;
             return(true);
         }
     }
     catch (TsRemoteSException ex)
     {
         //Error processing
         Console.WriteLine("disConnect: " + ex.Message);
     }
     return(false);
 }