Пример #1
0
        void CurrentTransferQueue_QueueProgressUpdated(object sender, EventArgs e)
        {
            TransferQueue tq = sender as TransferQueue;

            if (tq == null || tq.CurrentFtpClient == null)
            {
                return;
            }
            aaaSoft.Net.Ftp.FtpClient ftpClient = tq.CurrentFtpClient;
            Double progressDouble = ftpClient.TransferProgress;
            Int32  progressInt32  = Convert.ToInt32(progressDouble * (pbTransferProgress.Maximum - pbTransferProgress.Minimum) + pbTransferProgress.Minimum);

            if (progressInt32 < pbTransferProgress.Minimum)
            {
                progressInt32 = pbTransferProgress.Minimum;
            }
            if (progressInt32 > pbTransferProgress.Maximum)
            {
                progressInt32 = pbTransferProgress.Maximum;
            }

            this.BeginInvoke(new ThreadHelper.UnnamedDelegate(delegate()
            {
                pbTransferProgress.Value     = progressInt32;
                lblTransferUsedTime.Text     = String.Format("耗时:{0}", ftpClient.TransferUsedTime.ToString().Substring(0, 8));
                lblTransferProgressText.Text = String.Format("{0}%", progressInt32);
                lblTransferLeftTime.Text     = storageUnitStringConverting.GetString(ftpClient.ImmediateTransferSpeed, 2, false) + "B" + "/秒";
            }));
        }
Пример #2
0
 /// <summary>
 /// 创建新的FtpSite对象
 /// </summary>
 public void CreateFtpClient()
 {
     _FtpClient = new aaaSoft.Net.Ftp.FtpClient(HostName, Port, UserName, Password);
     _FtpClient.IsShowHidenFile       = IsShowHidenFile;
     _FtpClient.IsUseMlsdToListFolder = IsUseMlsdToListFolder;
     _FtpClient.IsNotSupportFEAT      = IsNotSupportFEAT;
     _FtpClient.StringEncoding        = StringEncoding;
     _FtpClient.BufferSize            = BufferSize;
     _FtpClient.Tag = this;
 }
Пример #3
0
        public void ConnectToSite(FtpSiteData siteData)
        {
            UnbindCurrentFtpSiteEvent();

            CurrentFtpClient = siteData.GetFtpClient();
            this.Invoke(new ThreadHelper.UnnamedDelegate(delegate
            {
                btnQuickConnect.Enabled = false;
                SetLvRemoteFileGray(false);

                BindCurrentFtpSiteEvent();
            }));

            var site = CurrentFtpClient;

            site.BeginLogin();
        }
Пример #4
0
        private void btnDisconnect_Click(object sender, EventArgs e)
        {
            if (CurrentFtpClient == null)
            {
                return;
            }

            var site          = CurrentFtpClient;
            var ftpClientData = (FtpSiteData)CurrentFtpClient.Tag;

            ThreadPool.QueueUserWorkItem(new WaitCallback(delegate
            {
                site.Quit();
            }));

            btnDisconnect.Enabled = false;
            ftpClientData.ClearFtpClient();
            CurrentFtpClient  = null;
            CurrentFolderPath = "";
            txtAddress.Text   = "";
            lvRemoteFile.Items.Clear();
            UnbindCurrentFtpSiteEvent();
        }
Пример #5
0
 /// <summary>
 /// 清除FtpSite对象
 /// </summary>
 public void ClearFtpClient()
 {
     _FtpClient = null;
 }