void site_ThreadBlocked(object sender, aaaSoft.Net.Ftp.FtpClient.FtpSiteEventArgs e) { if (aaaSoft.Helpers.ThreadHelper.IsCurrentThreadMainThread()) { Application.DoEvents(); } }
void site_LoginComplete(object sender, aaaSoft.Net.Ftp.FtpClient.FtpSiteEventArgs e) { if (CurrentFtpClient == null) { return; } var site = sender as aaaSoft.Net.Ftp.FtpClient; var CurrentFtpSiteData = (FtpSiteData)CurrentFtpClient.Tag; this.Invoke(new ThreadHelper.UnnamedDelegate(delegate { if (site.IsLogin) { btnDisconnect.Enabled = true; //列出指定的远端路径 if (e.ShouldListFolder) { BeginListFolder(CurrentFtpSiteData.RemotePath); } //列出指定的本地路径 if (!String.IsNullOrEmpty(CurrentFtpSiteData.LocalPath)) { fbLocal.ListFolder(CurrentFtpSiteData.LocalPath); } } else { LogHelper.PushLog("连接失败", Color.Red); btnQuickConnect.Enabled = true; } SetLvRemoteFileGray(true); })); }
void site_ListFolderComplete(object sender, aaaSoft.Net.Ftp.FtpClient.FtpSiteEventArgs e) { var site = sender as aaaSoft.Net.Ftp.FtpClient; var BaseFileList = e.BaseFileList; this.Invoke(new ThreadHelper.UnnamedDelegate(delegate { CurrentFolderPath = site.CurrentDirectoryPath; txtAddress.Text = CurrentFolderPath; lvRemoteFile.Items.Clear(); if (BaseFileList == null) { return; } foreach (var BaseFile in BaseFileList) { var newLvi = lvRemoteFile.Items.Add(BaseFile.Name); if (BaseFile.IsFolder) { newLvi.SubItems.Add(""); newLvi.ImageIndex = 0; } else if (BaseFile is FtpBaseFileInfo) { newLvi.SubItems.Add(storageUnitStringConverting.GetString(BaseFile.Length, 0, false) + "B"); newLvi.ImageIndex = 1; } newLvi.SubItems.Add(BaseFile.LastModifyTime.ToString()); newLvi.SubItems.Add(BaseFile.Property); newLvi.Tag = BaseFile; } SetLvRemoteFileGray(false); })); }
void site_LoginBegin(object sender, aaaSoft.Net.Ftp.FtpClient.FtpSiteEventArgs e) { var site = sender as aaaSoft.Net.Ftp.FtpClient; LogHelper.PushLog(String.Format("正在连接到 {0}", site.HostName), Color.Green); }