protected virtual void OnExecuteComplete(ref WFSRESULT result) { if (commandHandlers.ContainsKey(result.dwCommandCodeOrEventID)) { XFSCommandHandler handler = commandHandlers[result.dwCommandCodeOrEventID]; if (result.hResult == XFSDefinition.WFS_SUCCESS) { if (handler.EventHandler != null) { handler.EventHandler(); } else if (handler.SubRoutine != null) { handler.SubRoutine(result.lpBuffer); } } else { if (handler.ErrorHandler != null) { handler.ErrorHandler(serviceName, result.hResult, string.Empty); } } } }
protected override void WndProc(ref Message m) { if (m.Msg >= XFSDefinition.WFS_OPEN_COMPLETE && m.Msg <= XFSDefinition.WFS_SYSTEM_EVENT) { WFSRESULT result = new WFSRESULT(); if (m.LParam != IntPtr.Zero) { XFSUtil.PtrToStructure(m.LParam, ref result); } switch (m.Msg) { case XFSDefinition.WFS_OPEN_COMPLETE: OnOpenComplete(); break; case XFSDefinition.WFS_CLOSE_COMPLETE: OnCloseComplete(); break; case XFSDefinition.WFS_REGISTER_COMPLETE: OnRegisterComplete(); break; case XFSDefinition.WFS_EXECUTE_COMPLETE: OnExecuteComplete(ref result); break; case XFSDefinition.WFS_EXECUTE_EVENT: case XFSDefinition.WFS_SERVICE_EVENT: case XFSDefinition.WFS_USER_EVENT: case XFSDefinition.WFS_SYSTEM_EVENT: if (eventHandlers.ContainsKey(result.dwCommandCodeOrEventID)) { var temp = eventHandlers[result.dwCommandCodeOrEventID]; if (temp.EventHandler != null) { temp.EventHandler(); } else if (temp.SubRoutine != null) { temp.SubRoutine(result.lpBuffer); } } break; } XfsApi.WFSFreeResult(ref result); } else { base.WndProc(ref m); } }
protected override void WndProc(ref Message m) { if (m.Msg >= XFSDefinition.WFS_OPEN_COMPLETE && m.Msg <= XFSDefinition.WFS_TIMER_EVENT) { WFSRESULT result = new WFSRESULT(); if (m.LParam != IntPtr.Zero) { XFSUtil.PtrToStructure(m.LParam, ref result); } switch (m.Msg) { case XFSDefinition.WFS_OPEN_COMPLETE: OnOpenComplete(); break; case XFSDefinition.WFS_CLOSE_COMPLETE: OnCloseComplete(); break; case XFSDefinition.WFS_REGISTER_COMPLETE: OnRegisterComplete(); break; case XFSDefinition.WFS_EXECUTE_COMPLETE: OnExecuteComplete(ref result); break; case XFSDefinition.WFS_EXECUTE_EVENT: OnExecuteEvent(ref result); break; case XFSDefinition.WFS_SERVICE_EVENT: OnServiceEvent(ref result); break; case XFSDefinition.WFS_USER_EVENT: OnUserEvent(ref result); break; case XFSDefinition.WFS_SYSTEM_EVENT: OnSystemEvent(ref result); break; } XfsApi.WFSFreeResult(ref result); } else { base.WndProc(ref m); } }
protected virtual bool InnerGetInfo <T>(int category, IntPtr inParam, out T value) { IntPtr pOutParam = IntPtr.Zero; value = default(T); int hResult = XfsApi.WFSGetInfo(hService, category, inParam, TimeOut, ref pOutParam); if (hResult == XFSDefinition.WFS_SUCCESS) { WFSRESULT wfsResult = (WFSRESULT)Marshal.PtrToStructure(pOutParam, typeof(WFSRESULT)); if (wfsResult.hResult == XFSDefinition.WFS_SUCCESS) { value = (T)Marshal.PtrToStructure(wfsResult.lpBuffer, typeof(T)); return(true); } } XfsApi.WFSFreeResult(pOutParam); return(false); }
public static extern int WFSFreeResult(ref WFSRESULT lpResult);
protected virtual void OnSystemEvent(ref WFSRESULT result) { }
protected virtual void OnUserEvent(ref WFSRESULT result) { }
protected virtual void OnServiceEvent(ref WFSRESULT result) { }
protected virtual void OnExecuteEvent(ref WFSRESULT result) { }
protected virtual void OnExecuteComplete(ref WFSRESULT result) { }