RobotStudio event

Use this. Controller. Logon (the UserInfo. DefaultUser); There is an error

My code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using ABB.Robotics;
using ABB.Robotics.Controllers;
using ABB.Robotics.Controllers.Discovery;
using ABB.Robotics.Controllers.RapidDomain;
using ABB.Robotics.Controllers.MotionDomain;

namespace _3
{

    public partial class Form1 : Form
    {
        private NetworkScanner scanner = null;
        private Controller controller = null;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            this.scanner = new NetworkScanner();
            this.scanner.Scan();
            ControllerInfo[] controllers = scanner.GetControllers();
            ControllerInfo aControllerInfo = controllers[0];
            if (aControllerInfo.Availability == Availability.Available)
            {
                if (this.controller != null)
                {
                    this.controller.Logoff();
                    this.controller.Dispose();
                    this.controller = null;
                }
                this.controller = ControllerFactory.CreateFrom(aControllerInfo);
                this.controller.Logon(UserInfo.DefaultUser);
            }
            else
            {
                MessageBox.Show("控制器不可用");
            }
      }
}
Tagged:

Comments



  • I tried to run your code and in my case it works without any problems. Did you import the correct references? And as check you have to open RobotStudio with a system.