private async Task ExecuteLoadDocumentsCommand() { if (IsBusy) { return; } IsBusy = true; try { ContentTypes.Clear(); var contentTypes = await DataStore.GetContentTypesAsync(true); ContentTypes.ReplaceRange(contentTypes); } catch (Exception ex) { Debug.WriteLine(ex); MessagingCenter.Send(new MessagingCenterAlert { Title = "Error", Message = "Unable to load content types.", Cancel = "OK" }, "message"); } finally { IsBusy = false; } }
/// <summary> /// Creates an <see cref="ObjectResult"/> object with a gladnet content header. /// </summary> /// <param name="value">GladNet serializable object value.</param> public GladNetObjectResult(object value) : base(value) { //Writes the content types to be only the protobuf-net content type ContentTypes.Clear(); ContentTypes.Add(new MediaTypeHeaderValue("application/gladnet")); }
/// <summary> /// Initializes a new instance of the <see cref="ProblemResult" /> class. I will set the following: /// <para> /// <see cref="RequestErrorObject.Instance" /> value to the ActionContext.HttpContext.Request.Path /// </para> /// <para> /// <see cref="ObjectResult.StatusCode" /> value to the <see cref="RequestErrorObject.Status" /> /// </para> /// <para> /// I will clear all content types and add "application/problem+json" /// </para> /// </summary> /// <param name="error">The error.</param> public ProblemResult(RequestErrorObject error) : base(error) { _error = error; StatusCode = _error.Status; ContentTypes.Clear(); ContentTypes.Add(Constants.ResponseTypes.ErrorResponseContentType); }
// --- private APIResponse(HttpStatusCode statusCode, Response response) : base(response) { _httpStatusCode = statusCode; _response = response; StatusCode = (int)statusCode; DeclaredType = typeof(Response); ContentTypes.Clear(); ContentTypes.Add("application/json"); }
public IXLCFIconSet IconSet(XLIconSetStyle iconSetStyle, Boolean reverseIconOrder = false, Boolean showIconOnly = false) { IconSetOperators.Clear(); Values.Clear(); ContentTypes.Clear(); ConditionalFormatType = XLConditionalFormatType.IconSet; IconSetStyle = iconSetStyle; ReverseIconOrder = reverseIconOrder; ShowIconOnly = showIconOnly; return(new XLCFIconSet(this)); }