Logon to Controller using PC SDK
Lin
✭
I am new to this development.
I used the code given in RAB tutorial and tried with visual C# express 2008.
The other features
Display a controllers. Scanning a controller in local area. add to list view.
But double click the controller to logon is not working properly
My code is here:
private void Form1_DoubleClick(object sender, EventArgs e)
{
ListViewItem item = this.listView1.SelectedItems[0];
//UserInfo aUserInfo = new UserInfo("DefaultUser", "robotics");
if (item.Tag != null)
{
ControllerInfo controllerInfo = (ControllerInfo)item.Tag;
if (controllerInfo.Availability == Availability.Available)
{
if (this.controller != null)
{
this.controller.Logoff();
this.controller.Dispose();
this.controller = null;
}
this.controller = ControllerFactory.CreateFrom(controllerInfo);
this.controller.Logon(UserInfo.DefaultUser);
//this.controller.Logon(aUserInfo);
}
else
{
MessageBox.Show("Selected Controller is not Available");
}
}
}
I added the Listview1 - Events - Double Click property to "Form1_DoubleClick".
Shall i use this.controller.Logon(UserInfo.DefaultUser);
or the one i commented.
What else i should do.....
please help me to do this.
I used the code given in RAB tutorial and tried with visual C# express 2008.
The other features
Display a controllers. Scanning a controller in local area. add to list view.
But double click the controller to logon is not working properly
My code is here:
private void Form1_DoubleClick(object sender, EventArgs e)
{
ListViewItem item = this.listView1.SelectedItems[0];
//UserInfo aUserInfo = new UserInfo("DefaultUser", "robotics");
if (item.Tag != null)
{
ControllerInfo controllerInfo = (ControllerInfo)item.Tag;
if (controllerInfo.Availability == Availability.Available)
{
if (this.controller != null)
{
this.controller.Logoff();
this.controller.Dispose();
this.controller = null;
}
this.controller = ControllerFactory.CreateFrom(controllerInfo);
this.controller.Logon(UserInfo.DefaultUser);
//this.controller.Logon(aUserInfo);
}
else
{
MessageBox.Show("Selected Controller is not Available");
}
}
}
I added the Listview1 - Events - Double Click property to "Form1_DoubleClick".
Shall i use this.controller.Logon(UserInfo.DefaultUser);
or the one i commented.
What else i should do.....
please help me to do this.
Lingaa
0
Comments
-
I am using the robot studio in the same machine where i am running the application. Will it work or not?
Lingaa0 -
What error are you getting? UserInfo.DefaultUser should work fine. Are you sure you have an item selected in the listview first? Your code doesn't do anything if the tag property is null, you should display another error if it is null. You should step through the code with the debugger to follow what is happening.As an improvement, I would recommend using something other than a double-click of the listview as the means for for connecting. You could use a button's click event to execute the same code and disable the button until you have selected/activated an item in the listview.Russell Drown0
-
Hello,It should work. My code looks like this, and it works:
private void listView1_DoubleClick(object sender, EventArgs e)
{
ListViewItem item = this.listView1.SelectedItems[0];if (item.Tag != null)
{
ControllerInfo controllerInfo = (ControllerInfo)item.Tag;
if (controllerInfo.Availability == Availability.Available)
{
if (this._controller != null)
{
this._controller.Logoff();
this._controller.Dispose();
this._controller = null;
}
this._controller = ControllerFactory.CreateFrom(controllerInfo);
this._controller.Logon(UserInfo.DefaultUser);Best regards,
Ingela Brorsson
Software Engineer
ABB Robotics, Sweden0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings