public unsafe UCCNCplugin() { cppDll = new CppDll(cppDllPath()); delayedDllOperation = DllDelayedOperation.None; try { uc_callbacks = new PluginInterfaceEntry(); uc_callbacks.pGetField = new GetFieldCallBack(GetFieldHandler); uc_callbacks.pGetFieldInt = new GetFieldIntCallBack(GetFieldIntHandler); uc_callbacks.pGetFieldDouble = new GetFieldDoubleCallBack(GetFieldDoubleHandler); uc_callbacks.pGetLed = new GetLedCallBack(GetLedHandler); uc_callbacks.pIsMoving = new IsMovingCallBack(IsMovingHandler); uc_callbacks.pGetXpos = new GetXposCallBack(GetXposHandler); uc_callbacks.pGetYpos = new GetYposCallBack(GetYposHandler); uc_callbacks.pGetZpos = new GetZposCallBack(GetZposHandler); uc_callbacks.pGetApos = new GetAposCallBack(GetAposHandler); uc_callbacks.pGetBpos = new GetBposCallBack(GetBposHandler); uc_callbacks.pGetCpos = new GetCposCallBack(GetCposHandler); uc_callbacks.pGetGcodeFileName = new GetGetgcodefilenameCallBack(GetgcodefilenameHandler); uc_callbacks.pCode = new CodeCallBack(codeHandler); } catch (Exception e) { exceptionHandler(e, "setting uc_callbacks"); } // Do not load dll asynchronously at this point or Getproperties_event() call will never reach cpp dll: cppDll.Load(); cppDll.setCallBacks(uc_callbacks); }
public void processDelayedDllOperation() { switch (delayedDllOperation) { case DllDelayedOperation.Load: if (!cppDll.Load()) { MessageBox.Show("Loading cpp dll failed!"); } cppDll.setCallBacks(uc_callbacks); isFirstCycle = true; break; case DllDelayedOperation.Unload: if (!cppDll.Unload()) { MessageBox.Show("Unloading cpp dll failed!"); } break; } delayedDllOperation = DllDelayedOperation.None; }
public void unloadDllAsync() { delayedDllOperation = DllDelayedOperation.Unload; }