示例#1
0
        public MainWindow(ObservableCollection <DisplayTask> allTasks)
        {
            pref = new Preferences();

            InitializeComponent();

            CreateSystemTray();

            CreateBugTimer();

            UICommon.AddToProperties("MainWindow", this);

            AllTasks = allTasks;

            WIC          = new WorkItemController();
            WIC.AllTasks = AllTasks;

            WIC.ProcessQueue();

            Application.Current.Properties["WIC"] = WIC;

            lbUpdateQueue.ItemsSource = WIC.UpdateQueue;

            LoadData("All");
        }
        private void GetAreas(Project project)
        {
            List <string> Areas = new List <string>();

            foreach (Node areaNode in project.AreaRootNodes)
            {
                GetNodes(areaNode, Areas);
            }

            UICommon.AddToProperties("Areas", Areas);
        }
        private void GetUsers(TfsTeamProjectCollection tpc)
        {
            IIdentityManagementService2 identityManagementService = tpc.GetService <IIdentityManagementService2>();
            var validUsers = identityManagementService.ReadIdentities(IdentitySearchFactor.AccountName, new[] { "Project Collection Valid Users" }, MembershipQuery.Expanded, ReadIdentityOptions.None)[0][0].Members;
            var users      = identityManagementService.ReadIdentities(validUsers, MembershipQuery.None, ReadIdentityOptions.None).Where(x => !x.IsContainer).ToArray();
            var userNames  = users.Select(u => u.DisplayName).ToList();

            userNames.Sort();

            UICommon.AddToProperties("Users", userNames);
        }
        private void GetIterations(Project project)
        {
            List <string> Iterations = new List <string>();

            foreach (Node IterationNode in project.IterationRootNodes)
            {
                GetNodes(IterationNode, Iterations);
            }

            Iterations.Sort();
            Iterations.Reverse();

            UICommon.AddToProperties("Iterations", Iterations);
        }
        private void GetStates()
        {
            List <string> UserStoryStates = new List <string> {
                "Active", "New", "Closed", "Removed", "Resolved"
            };
            List <string> TaskStates = new List <string> {
                "Active", "New", "Closed", "Removed"
            };
            List <string> BugStates = new List <string> {
                "Active", "Resolved"
            };

            UICommon.AddToProperties("UserStoryStates", UserStoryStates);
            UICommon.AddToProperties("TaskStates", TaskStates);
            UICommon.AddToProperties("BugStates", BugStates);
        }
        public WorkItemCollection GetAllWorkItems()
        {
            TFSUser = ConfigurationManager.AppSettings["TFSUser"];
            UICommon.AddToProperties("MainUser", TFSUser);

            var retensionPeriod = Convert.ToInt32(ConfigurationManager.AppSettings["TFSRetention"]);
            var retensionDate   = DateTime.Now.Date.AddDays(retensionPeriod * -1);

            // Run a query.
            WorkItemCollection queryResults = workItemStore.Query(
                "Select *" +
                "From WorkItems " +
                "Where [Assigned To] = '" + TFSUser + "' " +
                "AND (([State] <> 'Closed' AND [State] <> 'Resolved' AND [State] <> 'Removed') OR [System.CreatedDate] > '" + retensionDate + "')");

            return(queryResults);
        }