/// <summary> /// Called when the user checks in a changeset. Posts a summary of /// the most recent check-in to Slack based on user preferences. /// </summary> async void VersionControlServer_CommitCheckin(object sender, CommitCheckinEventArgs e) { // Only post to Slack if user specified we should post to Slack. if (!m_viewModel.PostToSlack) { return; } IPendingChangesExt pendingChanges = GetService <IPendingChangesExt>(); var hyperlinkService = GetService <ITeamFoundationContextManager>() .CurrentContext.TeamProjectCollection .GetService <TswaClientHyperlinkService>(); try { await SlackServiceAdapter.PostToSlack(requestUri : m_viewModel.WebhookUrl, channelName : m_viewModel.Channel, userName : e.Workspace.OwnerDisplayName, changesetID : e.ChangesetId.ToString(), fileChangedCount : pendingChanges.IncludedChanges.Length, changesetComment : pendingChanges.CheckinComment, changesetUrl : hyperlinkService.GetChangesetDetailsUrl(e.ChangesetId).ToString()); m_viewModel.NotificationMessage = string.Format("Successfully posted changeset {0} to Slack.", e.ChangesetId); } catch (WebException ex) { m_viewModel.NotificationMessage = ex.ToString(); } catch { m_viewModel.NotificationMessage = "Error posting to Slack. The check-in still occurred. Look for an issue with your Post Check-In to Slack parameters before checking in again."; } }
private void versionControl_CommitCheckin(object sender, CommitCheckinEventArgs e) { var localEvent = ChangeCommitted; if (localEvent != null) { localEvent(this, e); } }
/// <summary> /// Event handler that raised on the commit of a new check-in. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event arguments.</param> private void OnVersionControlCommitCheckin(object sender, CommitCheckinEventArgs e) { if (_versionControlItem == null) { return; } string serverItem = _versionControlItem.ServerItem; bool itemCommitted = e.Changes.Any(change => change.ServerItem == serverItem); if (itemCommitted) { var task = new Task(() => { RefreshVersionControlItem(CancellationToken.None); }); task.Start(); } }
async void vcServer_CommitCheckin(object sender, CommitCheckinEventArgs e) { // Only post to Slack if user specified we should post to Slack. if (!m_viewModel.PostToSlack) { return; } IPendingChangesExt pendingChanges = GetService <IPendingChangesExt>(); var hyperlinkService = GetService <ITeamFoundationContextManager>() .CurrentContext.TeamProjectCollection .GetService <TswaClientHyperlinkService>(); try { var response = await SlackServiceAdapter.PostToSlack(requestUri : m_viewModel.WebhookUrl, channelName : m_viewModel.Channel, userName : e.Workspace.OwnerDisplayName, changesetID : e.ChangesetId.ToString(), fileChangedCount : pendingChanges.IncludedChanges.Length, changesetComment : pendingChanges.CheckinComment, changesetUrl : hyperlinkService.GetChangesetDetailsUrl(e.ChangesetId).ToString()); if (response.StatusCode == HttpStatusCode.OK) { ShowNotification("Successfully posted check-in message to Slack.", NotificationType.Information); } else { var errorMessage = "Error posting to Slack:\n" + response.StatusCode + " - " + await response.Content.ReadAsStringAsync(); ShowNotification(errorMessage, NotificationType.Error); } } catch { // FIXME: For some reason, ShowErrorNotification doesn't work in the context of this catch block. var errorMessage = "Error posting to Slack. The check-in still occurred. Look for an issue with your Post Check-In to Slack parameters before checking in again."; ShowNotification(errorMessage, NotificationType.Error); } }
/// <summary> /// Event handler that raised on the commit of a new check-in. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event arguments.</param> private void OnVersionControlCommitCheckin(object sender, CommitCheckinEventArgs e) { if (_versionControlItem == null) { return; } string serverItem = _versionControlItem.ServerItem; bool itemCommitted = e.Changes.Any(change => change.ServerItem == serverItem); if (itemCommitted) { var task = new Task(() => { lock (_drawLockObject) { try { _versionControlItem = GetVersionControlItem(); DownloadVersionControlItem(); Redraw(false, MarginDrawReason.VersionControlItemChanged); } catch (VersionControlItemNotFoundException) { SetMarginActivated(false); Redraw(false, MarginDrawReason.InternalReason); } catch (TeamFoundationServiceUnavailableException) { } } }); task.Start(); } }
/// <summary> /// Handles the CommitCheckin event of the versionControlServer control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Microsoft.TeamFoundation.VersionControl.Client.CommitCheckinEventArgs"/> instance containing the event data.</param> /// <remarks>Documented by CFI, 2010-06-27</remarks> protected void versionControlServer_CommitCheckin(object sender, CommitCheckinEventArgs e) { pluginUI.UpdatePendingChanges(); }
private void versionControl_CommitCheckin(object sender, CommitCheckinEventArgs e) { ChangeCommitted?.Invoke(this, e); }
/// <summary> /// Event handler that raised on the commit of a new check-in. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event arguments.</param> private void OnVersionControlCommitCheckin(object sender, CommitCheckinEventArgs e) { if (_versionControlItem == null) return; string serverItem = _versionControlItem.ServerItem; bool itemCommitted = e.Changes.Any(change => change.ServerItem == serverItem); if (itemCommitted) { var task = new Task(() => { lock (_drawLockObject) { try { _versionControlItem = GetVersionControlItem(); DownloadVersionControlItem(); Redraw(false, MarginDrawReason.VersionControlItemChanged); } catch (VersionControlItemNotFoundException) { SetMarginActivated(false); Redraw(false, MarginDrawReason.InternalReason); } catch (TeamFoundationServiceUnavailableException) { } } }); task.Start(); } }
void m_vcServer_CommitCheckin(object sender, CommitCheckinEventArgs e) { }
private void versionControl_CommitCheckin(object sender, CommitCheckinEventArgs e) { var localEvent = ChangeCommitted; if (localEvent != null) localEvent(this, e); }