コード例 #1
0
ファイル: ChatForm.cs プロジェクト: honj51/ideacode
        void ftpUpload_FileUploadProgress(object sender, FileUploadProgressEventArgs e)
        {
            this.Invoke(new UpdateUIDelegate(delegate(object obj)
            {
                FileUploadProgressEventArgs arg = e as FileUploadProgressEventArgs;
                displayUploadStatusMessage(e.Status, e.FileName);

                if (e.Status != UploadStatus.Uploading)
                {
                    uploadTasks.Remove(sender as FtpUpload);
                }

                if (e.Status == UploadStatus.Succeed)
                {
                    operatorServiceAgent.SendFile(e.FileName, chat.ChatId, "complete");
                }

            }), e);
        }
コード例 #2
0
ファイル: FileUploadControl.cs プロジェクト: honj51/ideacode
        void ftpUpload_FileUploadProgress(object sender, FileUploadProgressEventArgs e)
        {
            status = e.Status;
            //decimal speed = e.UploadChange.Speed;
            this.Invoke(new UpdateUI(delegate()
             {
                 progressBar1.Value += e.ContentLen;
                 this.lblProgress.Text = (progressBar1.Value / 1024) + "Kb /" + (fileSize / 1024) + "Kb";
             }));

            if (status == UploadStatus.Uploading)
            {
                return;
            }
            else if (status == UploadStatus.Error)
            {
                this.Invoke(new UpdateUI(delegate()
                {
                    this.lblSpeed.Text = "上传失败";
                }));
            }
            else if (status == UploadStatus.Cancel)
            {
                this.Invoke(new UpdateUI(delegate()
                {
                    this.lblSpeed.Text = "上传被取消";
                }));
            }
            else
            {
                status = UploadStatus.Succeed;
                this.Invoke(new UpdateUI(delegate()
                {
                    this.lblSpeed.Text = "上传成功";
                }));
            }

            if (FileUploadCompleted != null)
            {
                FileUploadCompleted(this, new FileUploadEventArgs(status, this, this.fileName));
            }
        }