public IntPtr HwndSourceHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
try
{
switch (msg)
{
case MicroconeAPI.WM_PNP_NOTIFICATION:
_unplugged = (wParam.ToInt32() == 2);
if (_unplugged)
{
MicroconeAPI.CloseClientConnection(_clientId);
_clientId = -1;
actions.microconeUnplugged();
}
else
{
InitClient();
actions.microconePluggedIn();
}
UpdateSettings();
break;
}
}
catch (Exception e)
{
App.NotifyDevelopers(e);
}
return IntPtr.Zero;
}