Ejemplo n.º 1
0
        public void Open(string logicName, bool paramAutoRegister = true,
                         string appID       = "XFS.NET", string lowVersion = "3.0",
                         string highVersion = "3.0")
        {
            autoRegister = paramAutoRegister;
            int requestVersion = XFSUtil.ParseVersionString(lowVersion,
                                                            highVersion);
            WFSVERSION srvcVersion = new WFSVERSION();
            WFSVERSION spVersion   = new WFSVERSION();
            int        hResult     = 0;

            if (!isStartup)
            {
                hResult = XfsApi.WFSStartUp(requestVersion, ref spVersion);
                if (hResult != XFSDefinition.WFS_SUCCESS &&
                    hResult != XFSDefinition.WFS_ERR_ALREADY_STARTED)
                {
                    OnOpenError(hResult);
                    return;
                }
            }
            hResult = XfsApi.WFSAsyncOpen(logicName, IntPtr.Zero, appID, 0,
                                          XFSConstants.WFS_INDEFINITE_WAIT, ref hService,
                                          MessageHandle, requestVersion, ref srvcVersion, ref spVersion,
                                          ref requestID);
            if (hResult != XFSDefinition.WFS_SUCCESS)
            {
                OnOpenError(hResult);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 3
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);
            }
        }