Beispiel #1
0
        /// <summary>
        /// Disposes of or finalises the object.
        /// </summary>
        /// <param name="disposing"></param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                CloseConnection();

                // The CloseConnection call should stop the derivee from accepting or attempting to make
                // any more connections. It should also close all existing connections. This block just
                // cleans up anything that is left lying around. The lock is for the benefit of other
                // threads that might still be in an event handler or something when this kicks off.
                IConnection[] connections;
                lock (_SyncLock) {
                    connections = _Connections.ToArray();
                    _Connections.Clear();
                }

                try {
                    foreach (var connection in connections)
                    {
                        connection.Dispose();
                    }
                } catch (Exception ex) {
                    OnExceptionCaught(new EventArgs <Exception>(ex));
                }

                RecordMiscellaneousActivity("Connector disposed");
                if (_ActivityLog != null)
                {
                    _ActivityLog.RecordConnectorDestroyed(this);
                }
                _ActivityLog = null;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new object.
        /// </summary>
        public Connector()
        {
            Created = DateTime.UtcNow;
            _IsMono = Factory.Singleton.ResolveSingleton <IRuntimeEnvironment>().IsMono;

            _ActivityLog = Factory.Singleton.ResolveSingleton <IConnectorActivityLog>();
            _ActivityLog.RecordConnectorCreated(this);
        }
Beispiel #3
0
        public DialogResult ShowView()
        {
            _ConnectorActivityLog = Factory.ResolveSingleton <IConnectorActivityLog>();
            _Presenter            = Factory.Resolve <IConnectorActivityLogPresenter>();
            _Presenter.Initialise(this);

            return(DialogResult.OK);
        }