예제 #1
0
 private void Btn_key_Click(object sender, RoutedEventArgs e)
 {
     if (btn_key.IsChecked == true) //连接
     {
         RuntimeScan scan = RuntimeScan.Instance;
         scan.macAddress = ScanDeviceController.Instance.GetUniqueName("10.0.0.119");
         if (!scan.isConnected)
         {
             if (!scan.Connect())
             {
                 DisConnect();
                 lab_con.Content   = "连接失败,请重新连接";
                 btn_key.IsChecked = false;
             }
             else
             {
                 lab_con.Content   = "已连接";
                 laser_status.Fill = Brushes.LimeGreen;
                 group1.IsEnabled  = true;
                 group2.IsEnabled  = true;
                 group1.Opacity    = 1;
                 group2.Opacity    = 1;
             }
         }
     }
     else //断开连接
     {
         DisConnect();
         lab_con.Content = "已断开连接";
     }
 }
예제 #2
0
        private void DisConnect()
        {
            RuntimeScan scan = RuntimeScan.Instance;

            scan.macAddress = ScanDeviceController.Instance.GetUniqueName("SMC [192.168.250.11]");
            scan.Disconnect();
            laser_status.Fill = Brushes.Red;
            group1.IsEnabled  = false;
            group2.IsEnabled  = false;
            group1.Opacity    = 0.5;
            group2.Opacity    = 0.5;
        }
예제 #3
0
        public void PointToPointCut(Point start_point, Point end_point, double power)
        {
            try
            {
                //振镜是否连接
                RuntimeScan scan = RuntimeScan.Instance;
                //移动位置,开始运行脚本
                Point[] points = new Point[2];

                scan.ScanStart(GetScript(start_point, end_point, power));
                while (ScanDeviceController.Instance.ScriptIsWork)
                {
                    Thread.Sleep(100);
                }
            }
            catch
            {
                MessageBox.Show("Cti振镜打标失败");
            }
        }