Skip to Content
0
Former Member
Jul 22, 2014 at 02:30 AM

OpenUI: pure virtual function call error

28 Views

Hi All,

I've implemented an OpenUI control for the Work Manager 6.1 WPF client which reads the current GPS location of the device and periodically sends it a scheduling system. The control is part of MainMenuScreen and works fine as long as the MainMenuScreen is open. It uses a Timer object to periodically run the following code to trigger an Agentry section which runs an Agentry transaction to send the GPS position:

this.Dispatcher.Invoke((Action)(() =>

{

AgentryClientSDK.IAgentryControlViewModelStringDisplay vm = DataContext as AgentryClientSDK.IAgentryControlViewModelStringDisplay;

if (vm != null)

{

if (vm.DoesAgentryActionExist(SEND_GPS_LOCATION_ACTION))

{

vm.ExecuteAgentryAction(SEND_GPS_LOCATION_ACTION);

}

}

}));

If the MainMenuScreen set is closed by the user so that only the Agentry client screen with the module list, the "Go On/Offline" button etc is visible and the Timer event fires to execute the coding above, I get this error when executing vm.DoesAgentryActionExist():

As soon as the user clicks "OK", Agentry client closes. There is no exception being raised.

According to this website, the error happens if a virtual function is called in a constructor or destructor. As at that line of code my coding is not doing that, I assume that it's caused by Agentry client.

Calling the whole code could be avoided if there is a way to check whether the Screenset/Screen on which the OpenUI control is located is still open or not but I haven't found a way yet.

Also it feels for me that the OpenUI control life-cycle is a little buggy. I would expect that if you close MainMenuScreen that it gets disposed.

Has anyone faced a similar situation yet or has suggestions how to check whether MainMenuScreen is open or not?

Thanks

Attachments

image001.png (10.8 kB)