Advertisement
Guest User

Untitled

a guest
Feb 19th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 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. using Microsoft.TeamFoundation.Framework.Client;
  10.  
  11. namespace TFSEvents
  12. {
  13. class Program
  14. {
  15. static void Main(string[] args)
  16. {
  17. try
  18. {
  19. Uri serverUri = new Uri(@"http://bach.consindia.in:8080/tfs");
  20. string username, password;
  21. Console.WriteLine("Enter Username:");
  22. username = Console.ReadLine();
  23. Console.WriteLine("Enter password:");
  24. password = ReadPassword();
  25. NetworkCredential cred = new NetworkCredential(username, password);
  26. TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(serverUri, cred);
  27. tfs.EnsureAuthenticated();
  28. IEventService vs = tfs.GetService<IEventService>();
  29. var wiww = tfs.GetService<WorkItemStore>();
  30. var wi = wiww.GetWorkItem(4671);
  31. wi.FieldChanged += new WorkItemFieldChangeEventHandler(changeHandler);
  32. var x = vs.GetAllEventSubscriptions().ToList();
  33. Console.WriteLine("Press 'q' to quit.");
  34. while (Console.ReadLine() != "q") ;
  35. }
  36. catch (Exception e)
  37. {
  38.  
  39. }
  40. }
  41.  
  42. private static void changeHandler(object o, WorkItemEventArgs e)
  43. {
  44. Console.WriteLine(e.Field);
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement