Stacker
Stacker

Reputation: 8237

Create a TFS Checkin Policy with configuration Settings

How is it possible to create a checkin policy which show a window on adding it, which take some configuration values from the users,

By example a checkin policy to check if a certain file exists in the pending changes, the question is when activating the checkin-policy I need to show a window which ask the admin for the name of the file.

 public override PolicyFailure[] Evaluate()
        {
            foreach (PendingChange pc in PendingCheckin.PendingChanges.AllPendingChanges)
            {

                FileInfo file = new FileInfo(pc.LocalOrServerItem.ToString());

                if (file.Name > NameProvidedOnActivatingCheckinPolicy)
                {
                    return new PolicyFailure[] { new PolicyFailure("File was not found", this) };
                }
            }
            return new PolicyFailure[0];
        }

How to ask for the NameProvidedOnActivatingCheckinPolicy at the time of activating the Checkin Policy

Upvotes: 0

Views: 74

Answers (1)

Stacker
Stacker

Reputation: 8237

Figured it out!

I had to override Edit Method and open up a windows form to get configurations

public override bool Edit(IPolicyEditArgs policyEditArgs)
        {
//open window form and get configurations
}

Upvotes: 1

Related Questions