I want to open a floading window if I get an alarm over modbus. Getting the modbus message and creating the analytics alarm is not the problem. If I try to open the floating window I get the Message from SmartClient that the calling thread has to be a STA-Thread. My programming is nearly the same as in the example SCHotSpot. I don’t use the “SelectedCameraChangedIndication” here I use “NewAlarmIndication”, see code snippet.
How can I put the call to the right thread?
I think, I found a solution for that. I use now:
_msgObj1 = _manager.RegisterReceiver(new MessageReceiver(NewAlarmMessageHandler), new MessageIdFilter(MessageId.Server.NewAlarmIndication));
\_msgObj1 = \_manager.RegisterReceiver(new MessageReceiver(ChangedAlarmMessageHandler), new MessageIdFilter(MessageId.Server.ChangedAlarmIndication));
instead of:
//MessageCommunicationManager.Start(_manager.MasterSite.ServerId);
//\_msgCommunication = MessageCommunicationManager.Get(\_manager.MasterSite.ServerId);
//\_msgObj1 = \_msgCommunication.RegisterCommunicationFilter(NewAlarmMessageHandler, new CommunicationIdFilter(MessageId.Server.NewAlarmIndication), null, EndPointType.Server);
//\_msgObj2 = \_msgCommunication.RegisterCommunicationFilter(ChangedAlarmMessageHandler, new CommunicationIdFilter(MessageId.Server.ChangedAlarmIndication), null, EndPointType.Server);
There is a timing issue registering the communication filters right after the start. Yes; you found a solution.