question

Upvotes
Accepted
65 0 1 3

Services.StateChanged

hi,

in the c# "DataApiUsageExampleRealtimeData", the events for

Services.StateChanged

only fire one dataServicesStateChangedEventArgs.State = DataServicesState.Up event once, but then never again. I can kill Eikon, I can close it, I can disconnect the Network connection no event.
I would expect some sort of event to fire on either of the described above. Is that realistic?

Thanks

Michael

eikoneikon-com-apieventsevent-handling
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Upvotes
Accepted
4.6k 26 7 22

@ma1057 the example is not really suitable for the demonstration of status change messages for several reasons, the most important being that the .NET API is tied to the COM message queue, so you need to run the COM event loop manually which is done with DispatcherFrame.Push() and Frame.Continue = False in the example.

The status event messages come in to the app, but they are not shown in the console.

If you would like to catch all the possible messages that occur during the changes, add Dispatcher.PushFrame(Frame) to the end of the void ServicesOnStateChanged routine.

Here I am starting Eikon, disabling network, re-enabling the network and fully exiting Eikon (shutdown through the tray process):

As you can see, all of the events are fired correctly.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

this did the trick:
"If you would like to catch all the possible messages that occur during the changes, add Dispatcher.PushFrame(Frame) to the end of the void ServicesOnStateChanged routine."