I can't find any way of listening to the EnterIdleEvent with the CONNECT .NET API. I guess it was possible in V8i to P/Invoke "mdlInput_setFunction (INPUT_ENTER_IDLE, OnEnterIdleState);" to get the same event, but it seems that this function is not exported in CONNECT anymore.
Is there any replacement?
Well, at the end, it was not too complicated to receive some more information using standard approach and tools (MicroStation SDK Update 12 used):
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
MISSING RESOURCE: VerifiedBy Tomáš Juřík
thank you for your helpful replies. The InputCallback::SetEnterIdleFunction method is public so it is callable. I have tried it with P/Invoke and it works well. See the code snippet bellow.
However, the exported name is decorated so the P/Invoke way of calling the method is not the best approach. Using the older C# COM API or C++/CLI wrapper is preferable.
private delegate void InputFunc_EnterIdle();
EntryPoint = "?SetEnterIdleFunction@InputCallback@@SAP6AXH@ZP6AXH@Z@Z",
ExactSpelling = true,
CallingConvention = CallingConvention.Cdecl)]
private static extern InputFunc_EnterIdle InputCallback_SetEnterIdleFunction(InputFunc_EnterIdle newFunc);
Tomáš Juřík said:However, the exported name is decorated so the P/Invoke way of calling the method is not the best approach
I agree. The solution would be report this issue to Bentley and to ask to add this event to API (because it's mentioned in migration tool already).
Tomáš Juřík said:Using the older C# COM API or C++/CLI wrapper is preferable.
Personally I prefer to use C++/CLI and to create own wrapper in all situations when it's not just one simple call of native API. In contrast to Interop it allows to stay close to native API and implement as much as possible there and also to optimize memory allocation and performance (which should be always priority when working with system events). On the other hand, Interop API allows to keep code simple and does not require to create ectra C++/CLI assembly ;-)
I hope we will see soon whether this issue is solved in Update 13.