Dispose() public method

Frees any unmanaged resources.
public Dispose ( ) : void
return void
Ejemplo n.º 1
0
        /// <summary>
        /// Creates an instance of the COM server.
        /// </summary>
        public void CreateInstance()
        {        
            // multiple calls are not allowed - may block for a while due to network operation.
            lock (m_lock)
            {
                ServerFactory factory = new ServerFactory();
                
                try
                {
                    // create the server.
                    Unknown = factory.CreateServer(new Uri(m_url), null);

                    // set the locale.
                    SetLocale(LocaleId);

                    if (UserIdentity != null)
                    {
                        SetUserIdentity(UserIdentity);
                    }

                    // do any post-connect processing.
                    OnConnected();
                }
                catch (Exception e)
                {
                    ComUtils.TraceComError(e, "Could not connect to server ({0}).", m_url);

                    // cleanup on error.
                    Close();
                }
                finally
                {
                    factory.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates an instance of the COM server.
        /// </summary>
        public void CreateInstance()
        {        
            // multiple calls are not allowed - may block for a while due to network operation.
            lock (m_lock)
            {
                ServerFactory factory = new ServerFactory();
                
                try
                {
                    // create the server.
                    Unknown = factory.CreateServer(new Uri(m_url), null);

                    // fetch the available locales.
                    m_availableLocaleIds = QueryAvailableLocales();

                    // do any post-connect processing.
                    OnConnected();
                }
                catch (Exception e)
                {
                    ComUtils.TraceComError(e, "Could not connect to server ({0}).", m_url);

                    // cleanup on error.
                    Close();
                }
                finally
                {
                    factory.Dispose();
                }
            }
        }