internal void Disconnect(EventHandler <FtpGetListingEventArgs> onGetListingDataReceived = null) { FtpClient.Connected -= OnConnected; if (onGetListingDataReceived != null) { FtpClient.GetListingDataReceived -= onGetListingDataReceived; } FtpTrace.RemoveListener(TraceListener); _keepAliveTimer.Elapsed -= KeepAliveTimerOnElapsed; FtpClient.Dispose(); }
/// <summary> /// Enables or disables FTP logging /// </summary> /// <param name="isSet">Enable or disable logging</param> public void SetFtpLogging(bool isSet) { try { FtpTrace.RemoveListener(FtpTraceListener); } catch { // ignored } if (isSet) { FtpTrace.AddListener(FtpTraceListener); FtpTrace.FlushOnWrite = true; } }
private void chkFTPTrace_CheckedChanged(object sender, EventArgs e) { if (chkFTPTrace.Checked) { if (_EventListBoxTrace == null) { _EventListBoxTrace = new EventListTraceLog(this); } FtpTrace.AddListener(_EventListBoxTrace); } else { if (_EventListBoxTrace != null) { FtpTrace.RemoveListener(_EventListBoxTrace); } } }