private async void btnCreateComment_Click(object sender, RoutedEventArgs e) { if (lstvActiveIssues.SelectedIndex < 0 && lstvClosedIssues.SelectedIndex < 0) { var dialog = new MessageDialog("Please select an issue!"); await dialog.ShowAsync(); } else { if (lstvActiveIssues.SelectedIndex >= 0) { if (!string.IsNullOrWhiteSpace(tbxComment.Text)) { Issue issue = (Issue)lstvActiveIssues.SelectedItem; await SqliteContext.CreateCommentAsync( new Comment { Description = tbxComment.Text, IssueId = issue.Id } ); } else { var dialog = new MessageDialog("Please Write a comment!"); await dialog.ShowAsync(); } } if (lstvClosedIssues.SelectedIndex >= 0) { if (!string.IsNullOrWhiteSpace(tbxComment.Text)) { Issue issue = (Issue)lstvClosedIssues.SelectedItem; await SqliteContext.CreateCommentAsync( new Comment { Description = tbxComment.Text, IssueId = issue.Id } ); } else { var dialog = new MessageDialog("Please Write a comment!"); await dialog.ShowAsync(); } } } ResetTextBoxes(); }
private async void CreateComment_Click(object sender, RoutedEventArgs e) { await SqliteContext.CreateCommentAsync( new Comment { Description = CommentBox.ToString(), IssueId = await SqliteContext.GetIssuesAsync(cmbIssueTitle.SelectedItem.ToString()) } ); await LoadIssueByTitleAsync(); }
private async void createComment_Click(object sender, RoutedEventArgs e) { var issueId = (sender as Button).Tag; await SqliteContext.CreateCommentAsync( new Comment { IssueId = (long)issueId, Description = tbxComment.Text } ); await LoadIssuesAsync(); }
private async void btnAddComment_Click(object sender, RoutedEventArgs e) { if (lvIssues.SelectedItem == null) { return; } Issue issue = (Issue)lvIssues.SelectedItem; Comment comment = new Comment( issue.Id, tbxCommentDescription.Text ); long id = await SqliteContext.CreateCommentAsync(comment); tbxCommentDescription.Text = ""; // Update list // issue.Comments = await SqliteContext.GetCommentsByIssueIdAsync(issue.Id, SettingsViewModel.MaxItemsCount); // IssueViewModel.ReplaceIssue(lvIssues.SelectedIndex, issue); }