using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.TeamFoundation.VersionControl.Client;
namespace TFSPMSIntegration
{
[Serializable]
public class CheckForPMSDetails : PolicyBase
{
public bool pmsDetailsConfirmed=false;
private static frmPmsDetails _frm = null;
public override string Description
{
get { return "Remind users to add PMS details to their checkins"; }
}
public override string InstallationInstructions
{
get { return "To install this policy, follow the instructions in CheckForPMSDetails.cs."; }
}
public override string Type
{
get { return "Check for PMS Details"; }
}
public override string TypeDescription
{
get { return "This policy will prompt the user to decide whether or not they should be allowed to check in."; }
}
public override bool Edit(IPolicyEditArgs args)
{
return true;
}
public override PolicyFailure[] Evaluate()
{
if (!pmsDetailsConfirmed)
{
return new PolicyFailure[] {
new PolicyFailure("Please provide PMS Details about your checkin", this),
};
}
else
{
if(_frm!=null)
PendingCheckin.PendingChanges.Comment = _frm.txtDescription.Text;
return new PolicyFailure[0];
}
}
public override void Activate(PolicyFailure failure)
{
if (_frm == null)
_frm = new frmPmsDetails(this);
else
_frm.CheckForPMSDetails = this;
_frm.WindowState = FormWindowState.Minimized;
_frm.TopMost = true;
_frm.Show();
_frm.ClearAll();
_frm.WindowState = FormWindowState.Normal;
_frm.BringToFront();
}
public void fn_Evaluate()
{
pmsDetailsConfirmed = true;
base.OnPolicyStateChanged(Evaluate());
}
public override void DisplayHelp(PolicyFailure failure)
{
MessageBox.Show("This policy helps you to remember to add PMS details to your checkins.", "Prompt Policy Help");
}
}
}
-
, VSIX,
.
VS 2010, VS 2012,
VS 2013,
Visual Studio ,
Visual Studio SDK . VSIX
Visual
Studio SDK.
VSIX Visual Studio 2012
1. visual studio 2012.
2. Extensibility VSIX.

- VSIX

, License.txt, : "policy.pkgdef"

- policy.pkgdef. , "pkgdef".
- policy.pkgdef :
[$ RootKey $\ TeamFoundation\SourceControl\Checkin Policies]
"TFSPMSIntegration" = "$ PackageFolder $\ TFSPMSIntegration.dll"

1: , , ,
2: , , " /".
- , vsixmanifest, source.extension.vsixmanifest.
"" "policy.pkgdef", " "

VSIX, . , Visual Studio.
* , " ",

