static void ShowDeleteFailedMessage(UITableView tableView, DeleteFailedException ex) { var message = string.Format("Well, that didn't work for {0} reason{2}: {1}", ex.FailureReasons.Count(), string.Join("; and ", ex.FailureReasons.Select(r => r.Message + ": " + string.Join(", ", r.RelatedIds))), ex.FailureReasons.Count() == 1 ? string.Empty : "s"); var alertView = new UIAlertView("Oops!", message, null, "Dismiss", null); alertView.Show(); tableView.ReloadData(); }
protected void CheckFileUploadStatus(string response) { UploadInfo info = DeserializeUploadResponse(response); if (info != null) { string errorMessage = HttpUtility.HtmlDecode(info.ErrorMessage); HttpUploadCode code = (HttpUploadCode) info.StatusCode; switch (code) { case HttpUploadCode.Ok: { break; } case HttpUploadCode.Unauthorized: { Exception = new UnauthorizedException(errorMessage); break; } case HttpUploadCode.NotFound: { Exception = new FileNotFoundException(errorMessage); break; } case HttpUploadCode.FileExists: { Exception = new FileExistsException(errorMessage); break; } case HttpUploadCode.BlockedFile: { Exception = new FileBlockedException(errorMessage); break; } case HttpUploadCode.FileLocked: { Exception = new FileLockedException(errorMessage); break; } case HttpUploadCode.DeleteFailed: { Exception = new DeleteFailedException(errorMessage); break; } default: { Exception = new UploadException(string.Format(CultureInfo.InvariantCulture, "Invalid status code : {0}", code)); break; } } } }