private void rejectBtn_Click(object sender, RoutedEventArgs e) { if (sender == null) { return; } string comments = getApprovalComments(); string status = "rejected"; ShowProgressBar(); Approval responseApproval; Task.Factory.StartNew(() => { responseApproval = VSTSService.PatchApproval(approval, status, comments); if (responseApproval != null) { approval = responseApproval; } }).ContinueWith(async(Task t) => { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { approvalCardSP.DataContext = approval; HideProgressBar(); }); }); }
private void approveBtn_Click(object sender, RoutedEventArgs e) { if (sender == null) { return; } string comments = getApprovalComments(); string status = "approved"; ShowProgressBar(); Approval responseApproval; Task.Factory.StartNew(() => { responseApproval = VSTSService.PatchApproval(approval, status, comments); if (responseApproval != null) { approval = responseApproval; } }).ContinueWith(async(Task t) => { await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { approvalCardSP.DataContext = approval; if (!approval.Status.ToLowerInvariant().Equals("pending")) { noProCommentsTB.Visibility = Visibility.Collapsed; } HideProgressBar(); }); }); }