Remote operator dialog box can't send answer

TompanhuhuTompanhuhu Sweden
edited October 2018 in Developer Tools

I’m trying to create a remote operator dialog with my PC app but can’t get the SendAnswer() method to work.

I have followed this guide: http://developercenter.robotstudio.com/blobproxy/devcenter/RobotCommunication/html/ae435101-731d-4fb3-be77-96e70b9aff19.htm

I have managed to catch the event, create a operator dialog and display header & messages. But I can’t return answer to robotcontroller.

I have tried the following code both on a virtual and a real controller.

I don’t get any error messages when trying the send the answer, nothing just happens.

If I answer the operator dialog on the robotcontroller my dialog is closed in the PC app so abort message is working fine.

Tpwrite & Tperase also works fine, and everything with uimsgbox works except sendanswer.

 

First I have created a subscription on the event.

//subscribing to event
robcontroller.Rapid.UIInstruction.UIInstructionEvent += new UIInstructionEventHandler(OnUIInstructionEvent); 

This is my eventhandler.

void OnUIInstructionEvent(object sender, ABB.Robotics.Controllers.RapidDomain.UIInstructionEventArgs e) {
            //Check what eventType is coming in
if (e.InstructionEventType == UIInstructionEventType.Post)
{
   if (e.InstructionType == UIInstructionType.TPWrite)     {
                    //Put latest tpwrite message on main screen
Form3.Instance.labelTpwrite.Text = e.EventMessage;
//Creat a listviewitem to add message to log listview
ListViewItem _temp = new ListViewItem(e.TaskName);
_temp.SubItems.Add(e.EventMessage);
//Add item to top of listview
tpwrite.Instance.listView1.Items.Insert(0,_temp);
}       
if (e.InstructionType == UIInstructionType.TPErase)   
{         
//Clear listview 
tpwrite.Instance.listView1.Items.Clear();
       }
}
            else if (e.InstructionEventType == UIInstructionEventType.Send) {
//If new op dialog is created, change image to alert operator message is avalible.     
Form3.Instance.pDialog.Image = Properties.Resources.dialog_new;
if (e.InstructionType == UIInstructionType.UIMessageBox)   {
//If messagetype is uimsgbox create new dialog window
uimsgbox Newbox = new uimsgbox(e);
}
else if (e.InstructionType == UIInstructionType.UIAlphaEntry) {
//If messagetype is AlphaEntry create new dialog window      var aen = e as UIAlphaEntryEventArgs;
uialpha newal = new uialpha(aen);

}
else if (e.InstructionEventType == UIInstructionEventType.Abort) {
//Abort dialog in the current task if there is any
foreach (TabPage _tab in opDialog.Instance.tabControl1.TabPages)     {
if (_tab.Name == e.TaskName) {                
_tab.Dispose();          
}
}
//If there is no avalible dialog reset dialog image.
if (opDialog.Instance.tabControl1.TabPages.Count == 0) Form3.Instance.pDialog.Image = Properties.Resources.dialog1;
}

This is my operator window object:

  

 
public partial class uimsgbox : UserControl
{
UIMessageBoxEventArgs eventobj;
public uimsgbox(UIInstructionEventArgs _e) {
InitializeComponent();
this.Dock = DockStyle.Fill;
//Add data from event object to local UIMessageBoxEventArgs object
eventobj = _e as UIMessageBoxEventArgs;
//I have also tried to instantly send answer when creating object but it dosen't work either
//eventobj.SendAnswer(UIButtonResult.OK);
//Fill dialog with header & message lines.
labelHeader.Text = eventobj.Header;
labelmsgline1.Text = eventobj.MsgArray[0].ToString();
labelmsgline2.Text = eventobj.MsgArray[1].ToString();
labelmsgline3.Text = eventobj.MsgArray[2].ToString();
labelmsgline4.Text = eventobj.MsgArray[3].ToString();
labelmsgline5.Text = eventobj.MsgArray[4].ToString();
//Create a new tabpage and add this control to page
TabPage _page = new TabPage(eventobj.TaskName);
_page.Name = eventobj.TaskName;
_page.Controls.Add(this);
opDialog.Instance.tabControl1.TabPages.Add(_page);
}
         private void button1_Click(object sender, EventArgs e){
eventobj.SendAnswer(UIButtonResult.Abort);
}
         private void button2_Click(object sender, EventArgs e){
eventobj.SendAnswer(UIButtonResult.Cancel);
}

         private void button3_Click(object sender, EventArgs e){

eventobj.SendAnswer(UIButtonResult.Ignore);

}
         private void button4_Click(object sender, EventArgs e){
eventobj.SendAnswer(UIButtonResult.No);
}
         private void button5_Click(object sender, EventArgs e){

eventobj.SendAnswer(UIButtonResult.OK);

}

         private void button6_Click(object sender, EventArgs e){
eventobj.SendAnswer(UIButtonResult.Retry);
}
         private void button7_Click(object sender, EventArgs e){
eventobj.SendAnswer(UIButtonResult.Yes);
}
}

 

I have created 7 buttons because I have tried every message available to return but none of them works.

 

Rapid code for messagebox:

UIMsgBox\Header:="This is a header","my simple message";

 

Image of operator dialog in PC app.



Can anyone tell me what I have done wrong?

I have tried everything I can think of.

 

Robotware: 6.07

PC SDK: 6.07

PC: Windows 10 pro

Best Answer

Answers

Sign In or Register to comment.