public void AddFileUpload(FileUploadCommand model, FileTransferCompletionStatus status) { string message = ""; if (status == FileTransferCompletionStatus.Successful) { message = string.Format("Successfully uploaded file '{0}' to user {1}", model.FileName, model.DestinationUserName); } else if (status == FileTransferCompletionStatus.Error) { message = string.Format("An error occurred uploading file '{0}' to user {1}", model.FileName, model.DestinationUserName); } else if (status == FileTransferCompletionStatus.Cancelled) { message = string.Format("Upload of file '{0}' to user {1} was cancelled", model.FileName, model.DestinationUserName); } else { return; } var pnl = AddSectionPanel(40); pnlMessages.ScrollControlIntoView(pnl); _prevControl = pnl; Label lbl = new Label(); lbl.Text = message; pnl.Controls.Add(lbl); lbl.AutoSize = true; lbl.Location = new Point(5, 5); }
private void NotifyFileDownloadStatus(FileDownloadCommand model, FileTransferCompletionStatus status) { var messageCtrl = GetMessageHistoryCtrlForUser(model.SourceUserName); if (messageCtrl == null) { return; } messageCtrl.AddFileDownload(model, status); }
void SetDownloadStatus(FileTransferCompletionStatus status) { _downloadStatus = status; if (_downloadStatus == FileTransferCompletionStatus.NotStarted) { cmdStartCancel.Visible = true; cmdStartCancel.Text = "Start"; lblFinishedStatus.Visible = false; progress.Visible = false; } else if (_downloadStatus == FileTransferCompletionStatus.Started) { cmdStartCancel.Text = "Cancel"; lblFinishedStatus.Visible = false; progress.Visible = true; } else if (_downloadStatus == FileTransferCompletionStatus.Successful) { cmdStartCancel.Visible = false; lblFinishedStatus.Visible = true; progress.Visible = false; lblFinishedStatus.Location = cmdStartCancel.Location; } else if (_downloadStatus == FileTransferCompletionStatus.Error) { cmdStartCancel.Visible = true; cmdStartCancel.Text = "Start"; lblFinishedStatus.Visible = true; progress.Visible = false; } else if (_downloadStatus == FileTransferCompletionStatus.Cancelled) { cmdStartCancel.Visible = true; cmdStartCancel.Text = "Start"; lblFinishedStatus.Visible = true; progress.Visible = false; } NotifyDownloadStatus(FileDownloadCommand, _downloadStatus); }