コード例 #1
0
 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);
             }
         }
     }
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
ファイル: XFSDeviceBase.cs プロジェクト: xxmedxx/XFS.Net
        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);
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: XfsApi.cs プロジェクト: xxmedxx/XFS.Net
 public static extern int WFSFreeResult(ref WFSRESULT lpResult);
コード例 #6
0
ファイル: XFSDeviceBase.cs プロジェクト: xxmedxx/XFS.Net
 protected virtual void OnSystemEvent(ref WFSRESULT result)
 {
 }
コード例 #7
0
ファイル: XFSDeviceBase.cs プロジェクト: xxmedxx/XFS.Net
 protected virtual void OnUserEvent(ref WFSRESULT result)
 {
 }
コード例 #8
0
ファイル: XFSDeviceBase.cs プロジェクト: xxmedxx/XFS.Net
 protected virtual void OnServiceEvent(ref WFSRESULT result)
 {
 }
コード例 #9
0
ファイル: XFSDeviceBase.cs プロジェクト: xxmedxx/XFS.Net
 protected virtual void OnExecuteEvent(ref WFSRESULT result)
 {
 }
コード例 #10
0
ファイル: XFSDeviceBase.cs プロジェクト: xxmedxx/XFS.Net
 protected virtual void OnExecuteComplete(ref WFSRESULT result)
 {
 }