Ejemplo n.º 1
0
 protected override void OnDisconnect(DdeConversation conversation)
 {
     Console.WriteLine("OnDisconnect:".PadRight(16)
         + " Service='" + conversation.Service + "'"
         + " Topic='" + conversation.Topic + "'"
         + " Handle=" + conversation.Handle.ToString());
 }
Ejemplo n.º 2
0
 protected override void OnStopAdvise(DdeConversation conversation, string item)
 {
     Console.WriteLine("OnStopAdvise:".PadRight(16)
         + " Service='" + conversation.Service + "'"
         + " Topic='" + conversation.Topic + "'"
         + " Handle=" + conversation.Handle.ToString()
         + " Item='" + item + "'");
 }
Ejemplo n.º 3
0
        protected override ExecuteResult OnExecute(DdeConversation conversation, string command)
        {
            Console.WriteLine("OnExecute:".PadRight(16)
                + " Service='" + conversation.Service + "'"
                + " Topic='" + conversation.Topic + "'"
                + " Handle=" + conversation.Handle.ToString()
                + " Command='" + command + "'");

            return base.OnExecute(conversation, command);
        }
Ejemplo n.º 4
0
        protected override ExecuteResult OnExecute(DdeConversation conversation, string command)
        {
            Console.WriteLine("OnExecute:".PadRight(16)
                + " Service='" + conversation.Service + "'"
                + " Topic='" + conversation.Topic + "'"
                + " Handle=" + conversation.Handle.ToString()
                + " Command='" + command + "'");

            // Tell the client that the command was processed.
            return ExecuteResult.Processed;
        }
Ejemplo n.º 5
0
        protected override bool OnStartAdvise(DdeConversation conversation, string item, int format)
        {
            Console.WriteLine("OnStartAdvise:".PadRight(16)
                + " Service='" + conversation.Service + "'"
                + " Topic='" + conversation.Topic + "'"
                + " Handle=" + conversation.Handle.ToString()
                + " Item='" + item + "'"
                + " Format=" + format.ToString());

            return base.OnStartAdvise(conversation, item, format);
        }
Ejemplo n.º 6
0
        protected override bool OnStartAdvise(DdeConversation conversation, string item, int format)
        {
            Console.WriteLine("OnStartAdvise:".PadRight(16)
                + " Service='" + conversation.Service + "'"
                + " Topic='" + conversation.Topic + "'"
                + " Handle=" + conversation.Handle.ToString()
                + " Item='" + item + "'"
                + " Format=" + format.ToString());

            // Initiate the advisory loop only if the format is CF_TEXT.
            return format == 1;
        }
Ejemplo n.º 7
0
        protected override PokeResult OnPoke(DdeConversation conversation, string item, byte[] data, int format)
        {
            Console.WriteLine("OnPoke:".PadRight(16)
                + " Service='" + conversation.Service + "'"
                + " Topic='" + conversation.Topic + "'"
                + " Handle=" + conversation.Handle.ToString()
                + " Item='" + item + "'"
                + " Data=" + data.Length.ToString()
                + " Format=" + format.ToString());

            return base.OnPoke(conversation, item, data, format);
        }
Ejemplo n.º 8
0
        /// <overloads>
        /// <summary>
        /// </summary>
        /// </overloads>
        /// <summary>
        /// This terminates the specified conversation.
        /// </summary>
        /// <param name="conversation">
        /// The conversation to terminate.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// This is thrown when conversation is a null reference.
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// This is thrown when the server is not registered.
        /// </exception>
        /// <exception cref="DdeException">
        /// This is thrown when the conversation could not be terminated.
        /// </exception>
        public virtual void Disconnect(DdeConversation conversation)
        {
            ThreadStart method = delegate()
            {
                DdemlObject.Disconnect(conversation.DdemlObject);
            };

            try
            {
                Context.Invoke(method);
            }
            catch (DdemlException e)
            {
                throw new DdeException(e);
            }
            catch (ArgumentException e)
            {
                throw e;
            }
            catch (ObjectDisposedException e)
            {
                throw new ObjectDisposedException(this.GetType().ToString(), e);
            }
        }
Ejemplo n.º 9
0
 protected override void OnStopAdvise(DdeConversation conversation, string item)
 {
     base.OnStopAdvise(conversation, item);
 }
Ejemplo n.º 10
0
        protected override RequestResult OnRequest(DdeConversation conversation, string item, int format)
        {
            Console.WriteLine("OnRequest:".PadRight(16)
                + " Service='" + conversation.Service + "'"
                + " Topic='" + conversation.Topic + "'"
                + " Handle=" + conversation.Handle.ToString()
                + " Item='" + item + "'"
                + " Format=" + format.ToString());

            // Return data to the client only if the format is CF_TEXT.
            if (format == 1)
            {
                return new RequestResult(System.Text.Encoding.ASCII.GetBytes("Time=" + DateTime.Now.ToString() + "\0"));
            }
            return DdeServer.RequestResult.NotProcessed;
        }
Ejemplo n.º 11
0
 protected override bool OnStartAdvise(DdeConversation conversation, string item, int format)
 {
     base.OnStartAdvise(conversation, item, format);
     return true;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// This is invoked when a client sends data.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 /// <param name="item">
 /// The item name associated with this event.
 /// </param>
 /// <param name="data">
 /// The data associated with this event.
 /// </param>
 /// <param name="format">
 /// The format of the data.
 /// </param>
 /// <returns>
 /// A <c>PokeResult</c> indicating the result.
 /// </returns>
 /// <remarks>
 /// The default implementation returns <c>PokeResult.NotProcessed</c> to the client.
 /// </remarks>
 protected virtual PokeResult OnPoke(DdeConversation conversation, string item, byte[] data, int format)
 {
     return PokeResult.NotProcessed;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// This is invoked when a client attempts to initiate an advise loop.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 /// <param name="item">
 /// The item name associated with this event.
 /// </param>
 /// <param name="format">
 /// The format of the data.
 /// </param>
 /// <returns>
 /// True to allow the advise loop, false otherwise.
 /// </returns>
 /// <remarks>
 /// The default implementation accepts all advise loops.
 /// </remarks>
 protected virtual bool OnStartAdvise(DdeConversation conversation, string item, int format)
 {
     return true;
 }
Ejemplo n.º 14
0
        /// <overloads>
        /// <summary>
        /// </summary>
        /// </overloads>
        /// <summary>
        /// This resumes the specified conversation.
        /// </summary>
        /// <param name="conversation">
        /// The conversation to resume.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// This is thrown when conversation is a null reference.
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// This is thrown when the conversation is not paused or when the server is not registered.
        /// </exception>
        /// <exception cref="DdeException">
        /// This is thrown when the conversation could not be resumed.
        /// </exception>
        public virtual void Resume(DdeConversation conversation)
        {
            ThreadStart method = delegate()
            {
                DdemlObject.Resume(conversation.DdemlObject);
            };

            try
            {
                Context.Invoke(method);
            }
            catch (DdemlException e)
            {
                throw new DdeException(e);
            }
            catch (ArgumentException e)
            {
                throw e;
            }
            catch (ObjectDisposedException e)
            {
                throw new ObjectDisposedException(this.GetType().ToString(), e);
            }
        }
Ejemplo n.º 15
0
 /// <summary>
 /// This is invoked when a client terminates a conversation.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 protected virtual void OnDisconnect(DdeConversation conversation)
 {
 }
Ejemplo n.º 16
0
 protected override void OnDisconnect(DdeConversation conversation)
 {
     base.OnDisconnect(conversation);
     _Conversation.Remove(conversation.Handle);
 }
Ejemplo n.º 17
0
 protected override RequestResult OnRequest(DdeConversation conversation, string item, int format)
 {
     base.OnRequest(conversation, item, format);
     string key = conversation.Topic + ":" + item + ":" + format.ToString();
     if (_Data.Contains(key))
     {
         return new RequestResult((byte[])_Data[key]);
     }
     return RequestResult.NotProcessed;
 }
Ejemplo n.º 18
0
 protected override ExecuteResult OnExecute(DdeConversation conversation, string command)
 {
     base.OnExecute(conversation, command);
     _Command = command;
     switch (command)
     {
         case "#NotProcessed":
             {
                 return ExecuteResult.NotProcessed;
             }
         case "#PauseConversation":
             {
                 if ((string)conversation.Tag == command)
                 {
                     conversation.Tag = null;
                     return ExecuteResult.Processed;
                 }
                 conversation.Tag = command;
                 if (!_Timer.Enabled) _Timer.Start();
                 return ExecuteResult.PauseConversation;
             }
         case "#Processed":
             {
                 return ExecuteResult.Processed;
             }
         case "#TooBusy":
             {
                 return ExecuteResult.TooBusy;
             }
     }
     return ExecuteResult.Processed;
 }
Ejemplo n.º 19
0
 protected override void OnAfterConnect(DdemlConversation conversation)
 {
     DdeConversation c = new DdeConversation(conversation);
     conversation.Tag = c;
     _Parent.OnAfterConnect(c);
 }
Ejemplo n.º 20
0
        protected override PokeResult OnPoke(DdeConversation conversation, string item, byte[] data, int format)
        {
            Console.WriteLine("OnPoke:".PadRight(16)
                + " Service='" + conversation.Service + "'"
                + " Topic='" + conversation.Topic + "'"
                + " Handle=" + conversation.Handle.ToString()
                + " Item='" + item + "'"
                + " Data=" + data.Length.ToString()
                + " Format=" + format.ToString());

            // Tell the client that the data was processed.
            return PokeResult.Processed;
        }
Ejemplo n.º 21
0
 protected override PokeResult OnPoke(DdeConversation conversation, string item, byte[] data, int format)
 {
     base.OnPoke(conversation, item, data, format);
     string key = conversation.Topic + ":" + item + ":" + format.ToString();
     _Data[key] = data;
     switch (item)
     {
         case "#NotProcessed":
             {
                 return PokeResult.NotProcessed;
             }
         case "#PauseConversation":
             {
                 if ((string)conversation.Tag == item)
                 {
                     conversation.Tag = null;
                     return PokeResult.Processed;
                 }
                 conversation.Tag = item;
                 if (!_Timer.Enabled) _Timer.Start();
                 return PokeResult.PauseConversation;
             }
         case "#Processed":
             {
                 return PokeResult.Processed;
             }
         case "#TooBusy":
             {
                 return PokeResult.TooBusy;
             }
     }
     return PokeResult.Processed;
 }
Ejemplo n.º 22
0
 /// <summary>
 /// This is invoked when a client attempts to initiate an advise loop.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 /// <param name="item">
 /// The item name associated with this event.
 /// </param>
 /// <param name="format">
 /// The format of the data.
 /// </param>
 /// <returns>
 /// True to allow the advise loop, false otherwise.
 /// </returns>
 /// <remarks>
 /// The default implementation accepts all advise loops.
 /// </remarks>
 protected virtual bool OnStartAdvise(DdeConversation conversation, string item, int format)
 {
     return true;
 }
Ejemplo n.º 23
0
 protected override void OnAfterConnect(DdeConversation conversation)
 {
     base.OnAfterConnect(conversation);
     _Conversation.Add(conversation.Handle, conversation);
 }
Ejemplo n.º 24
0
 /// <summary>
 /// This is invoked when a client terminates an advise loop.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 /// <param name="item">
 /// The item name associated with this event.
 /// </param>
 protected virtual void OnStopAdvise(DdeConversation conversation, string item)
 {
 }
Ejemplo n.º 25
0
 protected override void OnAfterConnect(DdemlConversation conversation)
 {
     DdeConversation c = new DdeConversation(conversation);
     conversation.Tag = c;
     _Parent.OnAfterConnect(c);
 }
Ejemplo n.º 26
0
 /// <summary>
 /// This is invoked when a client has successfully established a conversation.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 protected virtual void OnAfterConnect(DdeConversation conversation)
 {
 }
Ejemplo n.º 27
0
 /// <summary>
 /// This is invoked when a client has successfully established a conversation.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 protected virtual void OnAfterConnect(DdeConversation conversation)
 {
 }
Ejemplo n.º 28
0
 /// <summary>
 /// This is invoked when a client terminates a conversation.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 protected virtual void OnDisconnect(DdeConversation conversation)
 {
 }
Ejemplo n.º 29
0
 /// <summary>
 /// This is invoked when a client sends a command.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 /// <param name="command">
 /// The command to be executed.
 /// </param>
 /// <returns>
 /// An <c>ExecuteResult</c> indicating the result.
 /// </returns>
 /// <remarks>
 /// The default implementation returns <c>ExecuteResult.NotProcessed</c> to the client.
 /// </remarks>
 protected virtual ExecuteResult OnExecute(DdeConversation conversation, string command)
 {
     return ExecuteResult.NotProcessed;
 }
Ejemplo n.º 30
0
 /// <summary>
 /// This is invoked when a client sends a command.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 /// <param name="command">
 /// The command to be executed.
 /// </param>
 /// <returns>
 /// An <c>ExecuteResult</c> indicating the result.
 /// </returns>
 /// <remarks>
 /// The default implementation returns <c>ExecuteResult.NotProcessed</c> to the client.
 /// </remarks>
 protected virtual ExecuteResult OnExecute(DdeConversation conversation, string command)
 {
     return ExecuteResult.NotProcessed;
 }
Ejemplo n.º 31
0
 /// <overloads>
 /// <summary>
 /// </summary>
 /// </overloads>
 /// <summary>
 /// This is invoked when a client attempts to request data.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 /// <param name="item">
 /// The item name associated with this event.
 /// </param>
 /// <param name="format">
 /// The format of the data.
 /// </param>
 /// <returns>
 /// A <c>RequestResult</c> indicating the result.
 /// </returns>
 /// <remarks>
 /// The default implementation returns <c>RequestResult.NotProcessed</c> to the client.
 /// </remarks>
 protected virtual RequestResult OnRequest(DdeConversation conversation, string item, int format)
 {
     return RequestResult.NotProcessed;
 }
Ejemplo n.º 32
0
 /// <summary>
 /// This is invoked when a client sends data.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 /// <param name="item">
 /// The item name associated with this event.
 /// </param>
 /// <param name="data">
 /// The data associated with this event.
 /// </param>
 /// <param name="format">
 /// The format of the data.
 /// </param>
 /// <returns>
 /// A <c>PokeResult</c> indicating the result.
 /// </returns>
 /// <remarks>
 /// The default implementation returns <c>PokeResult.NotProcessed</c> to the client.
 /// </remarks>
 protected virtual PokeResult OnPoke(DdeConversation conversation, string item, byte[] data, int format)
 {
     return PokeResult.NotProcessed;
 }
Ejemplo n.º 33
0
 /// <summary>
 /// This is invoked when a client terminates an advise loop.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 /// <param name="item">
 /// The item name associated with this event.
 /// </param>
 protected virtual void OnStopAdvise(DdeConversation conversation, string item)
 {
 }
Ejemplo n.º 34
0
 /// <overloads>
 /// <summary>
 /// </summary>
 /// </overloads>
 /// <summary>
 /// This is invoked when a client attempts to request data.
 /// </summary>
 /// <param name="conversation">
 /// The conversation associated with this event.
 /// </param>
 /// <param name="item">
 /// The item name associated with this event.
 /// </param>
 /// <param name="format">
 /// The format of the data.
 /// </param>
 /// <returns>
 /// A <c>RequestResult</c> indicating the result.
 /// </returns>
 /// <remarks>
 /// The default implementation returns <c>RequestResult.NotProcessed</c> to the client.
 /// </remarks>
 protected virtual RequestResult OnRequest(DdeConversation conversation, string item, int format)
 {
     return RequestResult.NotProcessed;
 }