public sealed override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> parameters) { base.OnNavigatedTo(e, parameters); _userID = parameters[NavigationParameters.UserID] as string; _postID = parameters[NavigationParameters.PostID] as string; _entity = parameters[NavigationParameters.PostCommentEntity] as PostComment; OnPropertyChanged(() => Header); OnPropertyChanged(() => Content); }
public static PostComment Create(PostComment value) { if (value == null) throw new ArgumentNullException(nameof(value)); var result = new PostComment(); MigrateTracked(value, result); MigrateCompositeContent(value.Content, result.Content); return result; }
public sealed override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> parameters) { base.OnNavigatedTo(e, parameters); _userID = parameters[NavigationParameters.UserID] as string; _postID = parameters[NavigationParameters.PostID] as string; _entity = parameters[NavigationParameters.PostCommentEntity] as PostComment; OnPropertyChanged(() => Created); OnPropertyChanged(() => CreatorName); OnPropertyChanged(() => Content); _commandUpdate.RaiseCanExecuteChanged(); _commandRemove.RaiseCanExecuteChanged(); }
public CommentEntryViewModel(INavigationService navigationService, PostComment entity, string postID, string userID) { if (navigationService == null) throw new ArgumentNullException(nameof(navigationService)); if (entity == null) throw new ArgumentNullException(nameof(entity)); if (postID == null) throw new ArgumentNullException(nameof(postID)); if (userID == null) throw new ArgumentNullException(nameof(userID)); _navigationService = navigationService; _entity = entity; PostID = postID; _userID = userID; _commandNavigateWriteCommentPage = new DelegateCommand(CommandNavigateWriteCommentPageAction); }
public async Task<PostComment> CreatePostCommentAsync(string partyID, string postID, PostComment comment, CancellationToken terminator) { if (partyID == null) throw new ArgumentNullException(nameof(partyID)); if (postID == null) throw new ArgumentNullException(nameof(postID)); if (comment == null) throw new ArgumentNullException(nameof(comment)); VerifyServerAddress(); var uri = new Uri(FormattableString.Invariant($"{_server}/api/parties/{partyID}/posts/{postID}/comments")); var content = JsonObjectContent.Create(comment); using (var response = await _client.PostAsync(uri, content, terminator).ConfigureAwait(false)) { await VerifyResponseAsync(response); return await response.Content.ReadAsJsonObjectAsync<PostComment>().ConfigureAwait(false); } }