RobotStudio event

Remote Operator Dialog Box Can't Subscribe UIInstructionEvent

Options
Hello everyone!

I’m trying to create a remote operator dialog using PCSDK 2022.3 but event 
OnUIInstructionEvent isn't called when pointer is coming (no error is displayed, pointer runs through to the next command line without going into this event)


Comments

  • thuanly
    Options
    Here is my code to subscribe UIInstructionEvent:
           private void cb1_SelectionChanged(object sender, SelectionChangedEventArgs e)
           {
                scanner = new NetworkScanner();
                scanner.Scan();//scan all avaiable controllers
                ControllerInfoCollection controllers = scanner.Controllers;//save all avaiable controllers
                foreach (ControllerInfo controllerInfo in controllers)
                {
                    if(controllerInfo.SystemName == cb1.SelectedItem.ToString())
                    {
                        c = ControllerFactory.CreateFrom(controllerInfo);
                        c.Logon(UserInfo.DefaultUser);
                        lb_message.Content = "User was logon into " + c.SystemName + "!";
                        c.Rapid.UIInstruction.UIInstructionEvent += OnUIInstructionEvent;
                    }
                }
           }

            private void OnUIInstructionEvent(object sender, UIInstructionEventArgs e)
            {
                btn_ok.Content = "Test Subscribe";
                if (e.InstructionEventType == UIInstructionEventType.Send)
                {
                    if (e.InstructionType == UIInstructionType.UIMsgBox)
                    {
                        lb_message.Content = e.EventMessage;
                    }
                }
            }