/// <summary> /// Removes a connection by its given name /// </summary> /// <param name="name"></param> /// <returns></returns> public IServerConnection RemoveConnection(string name) { if (_connections.ContainsKey(name)) { var removing = this.ConnectionRemoving; var ce = new ServerConnectionRemovingEventArgs(name); if (removing != null) { removing(this, ce); } if (ce.Cancel) { return(null); } IServerConnection conn = _connections[name]; _connections.Remove(name); var removed = this.ConnectionRemoved; if (removed != null) { removed(this, new ServerConnectionEventArgs(name)); } return(conn); } return(null); }
/// <summary> /// Removes a connection by its given name /// </summary> /// <param name="name"></param> /// <returns></returns> public IServerConnection RemoveConnection(string name) { if (_connections.ContainsKey(name)) { var removing = this.ConnectionRemoving; var ce = new ServerConnectionRemovingEventArgs(name); if (removing != null) removing(this, ce); if (ce.Cancel) return null; IServerConnection conn = _connections[name]; _connections.Remove(name); var removed = this.ConnectionRemoved; if (removed != null) removed(this, name); return conn; } return null; }