Пример #1
0
        }     //ClientInvokeAsync()

        /// <summary>
        /// Callback handler used in ClientInvokeMethod().
        /// </summary>
        /// <param name="ar"></param>
        public void ByRefCallBack(IAsyncResult ar)
        {
            try
            {
                ByRefDelegate d = (ByRefDelegate)((AsyncResult)ar).AsyncDelegate;
                Console.WriteLine(d.EndInvoke(ar));
                m_ResetEvent.Set();
            }//try
            catch (Exception e)
            {
                Console.WriteLine("Exception in ByRefCallBack(): {0}", e.ToString());
                System.Diagnostics.Process.GetCurrentProcess().Kill();
            }//catch
            finally
            {
                //Unregister the channels so app can execute again.
                if (m_HttpChannel != null)
                {
                    ChannelServices.UnregisterChannel(m_HttpChannel);
                }//if

                if (m_TcpChannel != null)
                {
                    ChannelServices.UnregisterChannel(m_TcpChannel);
                } //if
            }     //finally
        }         //ByRefCallBack()
Пример #2
0
        }     //ClientInvokeAsync()

        /// <summary>
        /// Callback handler used in ClientInvokeMethod().
        /// </summary>
        /// <param name="ar"></param>
        public void ByRefCallBack(IAsyncResult ar)
        {
            try
            {
                ByRefDelegate d = (ByRefDelegate)((AsyncResult)ar).AsyncDelegate;
                Console.WriteLine(d.EndInvoke(ar));
                m_ResetEvent.Set();
            }//try
            catch (Exception e)
            {
                Console.WriteLine("Exception in ByRefCallBack(): {0}", e.ToString());
                System.Diagnostics.Process.GetCurrentProcess().Kill();
            } //catch
        }     //ByRefCallBack()