Exemple #1
0
        public void test()
        {
            ProxyInterface proxy = (ProxyInterface)XmlRpcProxyGen.Create(typeof(ProxyInterface));

            MessageBox.Show(proxy.sayHello());
            Console.WriteLine(proxy.sayHello());
            Console.ReadLine();
        }
Exemple #2
0
        /// <summary>
        /// Closes the factory or aborts it as needed. Ensures that the Closed event is raised.
        /// </summary>
        public virtual void Close()
        {
            if (keepAliveTimer != null)
            {
                keepAliveTimer.Enabled = false;
                keepAliveTimer.Dispose();
                keepAliveTimer = null;
            }

            //close Proxy / Channel
            if (_proxy != null)
            {
                ProxyInterface.Faulted -= new EventHandler(Proxy_Faulted);
                ProxyInterface.Closed  -= new EventHandler(Proxy_Faulted);

                try
                {
                    if (ProxyInterface.State == CommunicationState.Opened)
                    {
                        ProxyInterface.Close();
                    }
                    else if ((ProxyInterface.State != CommunicationState.Closing) &&
                             (ProxyInterface.State != CommunicationState.Closed))
                    {
                        ProxyInterface.Abort();
                    }
                }
                catch (Exception ex)
                {
                    ErrorLogger.DumpToDebug(ex);
                }

                Proxy = default(TContract);
            }

            //close Factory
            if (Factory != null)
            {
                try
                {
                    if (Factory.State == CommunicationState.Opened)
                    {
                        Factory.Close();
                    }
                    else if ((Factory.State != CommunicationState.Closing) &&
                             (Factory.State != CommunicationState.Closed))
                    {
                        Factory.Abort();
                    }
                }
                catch (Exception ex)
                {
                    ErrorLogger.DumpToDebug(ex);
                }

                Factory.Opened  -= new EventHandler(Factory_Opened);
                Factory.Closed  -= new EventHandler(Factory_Closed);
                Factory.Faulted -= new EventHandler(Factory_Closed);
                Factory          = null;
            }
            else
            {
                FireClosed();
            }
        }
Exemple #3
0
 public WeddingCompany(ProxyInterface proxyInterface)
 {
     this.proxyInterface = proxyInterface;
 }