Advertisement
Guest User

Untitled

a guest
Feb 18th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Microsoft.TeamFoundation.Client;
  6. using System.Net;
  7. using Microsoft.TeamFoundation.VersionControl.Client;
  8. using Microsoft.TeamFoundation.WorkItemTracking.Client;
  9.  
  10. namespace TFSEvents
  11. {
  12. class Program
  13. {
  14. static void Main(string[] args)
  15. {
  16. Uri serverUri = new Uri(@"http://tfs");
  17. string username, password;
  18. Console.WriteLine("Enter Username:");
  19. username = Console.ReadLine();
  20. Console.WriteLine("Enter password:");
  21. password = ReadPassword();
  22. NetworkCredential cred = new NetworkCredential(username, password);
  23. TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(serverUri, cred);
  24. tfs.EnsureAuthenticated();
  25. VersionControlServer vs = tfs.GetService<VersionControlServer>();
  26. Changeset cs= vs.GetChangeset(12345);
  27. WorkItem[] wi = cs.WorkItems;
  28. wi[0].FieldChanged += new WorkItemFieldChangeEventHandler(changeHandler);
  29. while (Console.ReadLine() != "q") ;
  30. }
  31.  
  32. private static void changeHandler(object o, WorkItemEventArgs e)
  33. {
  34. Console.WriteLine(e.Field);
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement