private async void Edit_Click(object sender, RoutedEventArgs e) { btnEdit.IsEnabled = false; var title = LocalizationUtils.GetLocalized("EditingPostTitle"); var message = LocalizationUtils.GetLocalized("EditingPostMessage"); string oldValue = CurrentPostData.Text; string value = await DialogManager.ShowMultilineTextDialog( title, message, oldValue) .ConfigureAwait(true); if (value == null) { btnEdit.IsEnabled = true; return; } PostEditSchema postEditData = new PostEditSchema { Id = CurrentPostData.Id, Text = value, IsAdult = CurrentPostData.IsAdult, IsAnonymous = CurrentPostData.IsAnonymous, CategoryId = CurrentPostData.CategoryId, Filter = CurrentPostData.Filter, IsHidden = CurrentPostData.IsHidden, IsCommentsOpen = CurrentPostData.IsCommentsOpen, Type = CurrentPostData.Type }; var request = await PostApi.Edit( SettingsManager.PersistentSettings.CurrentUser.Token, postEditData) .ConfigureAwait(true); if (request.IsError) { await DialogManager.ShowErrorDialog(request.Message) .ConfigureAwait(true); btnEdit.IsEnabled = true; return; } CurrentPostData.Text = value; btnEdit.IsEnabled = true; }
public static Task <ApiResponse> Edit(string token, PostEditSchema schema) { return(ApiRequestEngine.ExecuteAnonymRequestJson("posts/edit", schema, token)); }