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

Best Answer

  • @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):

    image

    image

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

Answers

  • 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."