示例#1
0
        private void Scan(object sender, object e)
        {
            //Reset Controllers
            if (controllers != null)
            {
                foreach (var controller in controllers)
                {
                    controller.LogOff();
                }
                controllers = new List <Controller>();
            }

            // Find ABB robots on the network
            NetworkScanner scanner = new NetworkScanner();

            scanner.Scan();

            if (ipAddresses != null)
            {
                // Scan the network for controllers and add them to our controller array.
                foreach (string ip in ipAddresses)
                {
                    NetworkScanner.AddRemoteController(ip);
                }
            }
            ControllerInfo[] controllersID = scanner.GetControllers();
            foreach (ControllerInfo id in controllersID)
            {
                controllers.Add(new AbbIRC5Contoller(id));
            }

            // Possibility to scan for other robots

            // Allow value list to be updated
            updateVL = true;

            if (controllers != null)
            {
                if (controllers.Count > 0)
                {
                    log.Add("Controllers found:");

                    // List the controller names that were found on the network.
                    for (int i = 0; i < controllers.Count; i++)
                    {
                        log.Add(controllers[i].Name);
                    }
                }
                else
                {
                    log.Add("Scan timed out. No controllers were found.");
                }
            }
            ExpireSolution(true);
        }
示例#2
0
 private void button_addRemote_Click(object sender, RoutedEventArgs e)
 {
     System.Net.IPAddress ipAddress;
     try
     {
         ipAddress = System.Net.IPAddress.Parse(this.textBox_remoteIPAddress.Text);
         NetworkScanner.AddRemoteController(ipAddress);
     }
     catch (FormatException ex)
     {
         MessageBox.Show("Wrong IP address format: " + ex.Message);
     }
     this.refreshControllers();
 }