Exemplo n.º 1
0
            public MsmqChannelOutputAsyncResult(MsmqOutputChannel channel, Message message, TimeSpan timeout, AsyncCallback callback, object state)
            {
                this.channel  = channel;
                this.message  = message;
                this.timeout  = timeout;
                this.callback = callback;
                this.state    = state;

                wait = new AutoResetEvent(false);
                Thread t = new Thread(delegate()
                {
                    try
                    {
                        channel.Send(message, timeout);
                        if (callback != null)
                        {
                            callback(this);
                        }
                    }
                    catch (Exception ex)
                    {
                        error = ex;
                    }
                    finally
                    {
                        done = true;
                        wait.Set();
                    }
                });

                t.Start();
            }
Exemplo n.º 2
0
			public MsmqChannelOutputAsyncResult (MsmqOutputChannel channel, Message message, TimeSpan timeout, AsyncCallback callback, object state)
			{
				this.channel = channel;
				this.message = message;
				this.timeout = timeout;
				this.callback = callback;
				this.state = state;

				wait = new AutoResetEvent (false);
				Thread t = new Thread (delegate () {
					try {
						channel.Send (message, timeout);
						if (callback != null)
							callback (this);
					} catch (Exception ex) {
						error = ex;
					} finally {
						done = true;
						wait.Set ();
					}
				});
				t.Start ();
			}