Example #1
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);
            }
        }
Example #2
0
        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);
            }
        }
Example #3
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);
        }