Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Addin is not capturing events

$
0
0

I have created an addin in the hopes of performing extra work on a checkin to Source Control.  The following is an example of what I am trying to do.  Does anyone have any idea why this is not working?

 

using

System;

using System.Windows.Forms;

using

Extensibility;

using

EnvDTE;

using

EnvDTE80;

using

Microsoft.TeamFoundation.Server;

using

Microsoft.TeamFoundation.Client;

using

Microsoft.TeamFoundation.VersionControl.Client;

using

Microsoft.VisualStudio.TeamFoundation;

using

Microsoft.VisualStudio.TeamFoundation.VersionControl;

namespace

SCADDIN

{

publicclassConnect : IDTExtensibility2

{

public Connect()

{

}

publicvoid OnConnection(object application, ext_ConnectMode connectMode, object addInInst, refArray custom)

{

_applicationObject = (

DTE2)application;

_addInInstance = (

AddIn)addInInst;

}

publicvoid OnDisconnection(ext_DisconnectMode disconnectMode, refArray custom)

{

}

publicvoid OnAddInsUpdate(refArray custom)

{

}

publicvoid OnStartupComplete(refArray custom)

{

//Get a reference to our Team Foundation Server.

_tfse = _applicationObject.GetObject(

"Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt") asTeamFoundationServerExt;

MessageBox.Show(_tfse.ActiveProjectContext.DomainUri, "TFSNAME", MessageBoxButtons.OK, MessageBoxIcon.Information);

_tfs =

newTeamFoundationServer(_tfse.ActiveProjectContext.DomainUri);

//Get a reference to Version Control

_vcs = (

VersionControlServer)_tfs.GetService(typeof(VersionControlServer));

//Listen for the Source Control events.

_vcs.NonFatalError +=

Connect.OnNonFatalError;

_vcs.Getting +=

Connect.OnGetting;

_vcs.BeforeCheckinPendingChange +=

Connect.OnBeforeCheckinPendingChange;

_vcs.NewPendingChange +=

Connect.OnNewPendingChange;

}

publicvoid OnBeginShutdown(refArray custom)

{

}

internalstaticvoid OnNonFatalError(Object sender, ExceptionEventArgs e)

{

if (e.Exception != null)

{

MessageBox.Show("Non-Fatal exception: " + e.Exception.Message, "NonFatalError Event", MessageBoxButtons.OK, MessageBoxIcon.Error);

}

else

{

MessageBox.Show("Non-Fatal failure: " + e.Failure.Message, "NonFatalError Event", MessageBoxButtons.OK, MessageBoxIcon.Error);

}

}

internalstaticvoid OnGetting(Object sender, GettingEventArgs e)

{

MessageBox.Show("Getting: " + e.TargetLocalItem + ", status: " + e.Status, "Getting Event", MessageBoxButtons.OK, MessageBoxIcon.Information);

}

internalstaticvoid OnBeforeCheckinPendingChange(Object sender, ProcessingChangeEventArgs e)

{

MessageBox.Show("Checking In :" + e.PendingChange.LocalItem);

}

internalstaticvoid OnNewPendingChange(Object sender, PendingChangeEventArgs e)

{

MessageBox.Show("Pending: " + PendingChange.GetLocalizedStringForChangeType(e.PendingChange.ChangeType) + " on " + e.PendingChange.LocalItem);

}

privateDTE2 _applicationObject;

privateAddIn _addInInstance;

privateTeamFoundationServerExt _tfse;

privateTeamFoundationServer _tfs;

privateVersionControlServer _vcs;

}

}


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>