internal DdeConversation(DdemlConversation conversation)
 {
     _DdemlObject = conversation;
     _DdemlObject.StateChange += this.OnStateChange;
     _Service = _DdemlObject.Service;
     _Topic = _DdemlObject.Topic;
     _Handle = _DdemlObject.Handle;
     _IsPaused = _DdemlObject.IsPaused;
 }
 protected override RequestResult OnRequest(DdemlConversation conversation, string item, int format)
 {
     DdeServer.RequestResult result = _Parent.OnRequest((DdeConversation)conversation.Tag, item, format);
     if (result == DdeServer.RequestResult.NotProcessed)
     {
         return RequestResult.NotProcessed;
     }
     if (result == DdeServer.RequestResult.PauseConversation)
     {
         return RequestResult.PauseConversation;
     }
     if (result == DdeServer.RequestResult.Processed)
     {
         return new RequestResult(result.Data);
     }
     return RequestResult.NotProcessed;
 }
 protected override PokeResult OnPoke(DdemlConversation conversation, string item, byte[] data, int format)
 {
     DdeServer.PokeResult result = _Parent.OnPoke((DdeConversation)conversation.Tag, item, data, format);
     if (result == DdeServer.PokeResult.NotProcessed)
     {
         return PokeResult.NotProcessed;
     }
     if (result == DdeServer.PokeResult.PauseConversation)
     {
         return PokeResult.PauseConversation;
     }
     if (result == DdeServer.PokeResult.Processed)
     {
         return PokeResult.Processed;
     }
     if (result == DdeServer.PokeResult.TooBusy)
     {
         return PokeResult.TooBusy;
     }
     return PokeResult.NotProcessed;
 }
 protected override ExecuteResult OnExecute(DdemlConversation conversation, string command)
 {
     DdeServer.ExecuteResult result = _Parent.OnExecute((DdeConversation)conversation.Tag, command);
     if (result == DdeServer.ExecuteResult.NotProcessed)
     {
         return ExecuteResult.NotProcessed;
     }
     if (result == DdeServer.ExecuteResult.PauseConversation)
     {
         return ExecuteResult.PauseConversation;
     }
     if (result == DdeServer.ExecuteResult.Processed)
     {
         return ExecuteResult.Processed;
     }
     if (result == DdeServer.ExecuteResult.TooBusy)
     {
         return ExecuteResult.TooBusy;
     }
     return ExecuteResult.NotProcessed;
 }
 protected override void OnDisconnect(DdemlConversation conversation)
 {
     _Parent.OnDisconnect((DdeConversation)conversation.Tag);
 }
 protected override void OnAfterConnect(DdemlConversation conversation)
 {
     DdeConversation c = new DdeConversation(conversation);
     conversation.Tag = c;
     _Parent.OnAfterConnect(c);
 }
 protected virtual void OnStopAdvise(DdemlConversation conversation, string item)
 {
 }
        public virtual void Disconnect(DdemlConversation conversation)
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException(this.GetType().ToString());
            }
            if (!IsRegistered)
            {
                throw new InvalidOperationException(Resources.NotRegisteredMessage);
            }
            if (conversation == null)
            {
                throw new ArgumentNullException("conversation");
            }

            if (_ConversationTable.ContainsKey(conversation.Handle))
            {
                // Terminate the conversation.
                Ddeml.DdeDisconnect(conversation.Handle);

                // Remove the Conversation from the conversation table.
                _ConversationTable.Remove(conversation.Handle);
            }
        }
 protected virtual RequestResult OnRequest(DdemlConversation conversation, string item, int format)
 {
     return RequestResult.NotProcessed;
 }
 protected virtual PokeResult OnPoke(DdemlConversation conversation, string item, byte[] data, int format)
 {
     return PokeResult.NotProcessed;
 }
 protected virtual ExecuteResult OnExecute(DdemlConversation conversation, string command)
 {
     return ExecuteResult.NotProcessed;
 }
 protected virtual void OnDisconnect(DdemlConversation conversation)
 {
 }
 protected virtual void OnAfterConnect(DdemlConversation conversation)
 {
 }
        public virtual void Resume(DdemlConversation conversation)
        {
            if (IsDisposed)
            {
                throw new ObjectDisposedException(this.GetType().ToString());
            }
            if (!IsRegistered)
            {
                throw new InvalidOperationException(Resources.NotRegisteredMessage);
            }
            if (conversation == null)
            {
                throw new ArgumentNullException("conversation");
            }
            if (!conversation.IsPaused)
            {
                throw new InvalidOperationException(Resources.NotPausedMessage);
            }

            // Enable the DDEML callback for the specified conversation only.
            bool result = Ddeml.DdeEnableCallback(_InstanceId, conversation.Handle, Ddeml.EC_ENABLEALL);

            // Check the result to see if the DDEML callback was enabled.
            if (!result)
            {
                int error = Ddeml.DdeGetLastError(_InstanceId);
                throw new DdemlException(Resources.ServerResumeFailedMessage, error);
            }

            // Decrement the conversation's waiting count.  The conversation will only resume if the count is zero.
            conversation.DecrementWaiting();
        }
示例#15
0
 protected override bool OnStartAdvise(DdemlConversation conversation, string item, int format)
 {
     return _Parent.OnStartAdvise((DdeConversation)conversation.Tag, item, format);
 }
示例#16
0
 protected override void OnStopAdvise(DdemlConversation conversation, string item)
 {
     _Parent.OnStopAdvise((DdeConversation)conversation.Tag, item);
 }
 protected virtual bool OnStartAdvise(DdemlConversation conversation, string item, int format)
 {
     return true;
 }