void CancelTransfer(TransferHandle handle, bool warn = true) { if (warn && (handle.Status == TransferHandleStatus.Downloading || handle.Status == TransferHandleStatus.Uploading)) { var type = (handle.Status == TransferHandleStatus.Downloading ? "download" : "upload"); var text = String.Format("Are you sure to cancel the {0} process for {1}?", type, handle.Node.Attributes.Name); if (MessageBox.Show(text, "Cancel " + type, MessageBoxButton.YesNo) == MessageBoxResult.No) { return; } } handle.CancelTransfer(); }