public WorkItemState(WorkItemType wit) { this.wit = wit; selectedInProgressState = selectedApprovedState = initialState = wit.NewWorkItem().State; closedStates = new List<string> {"Done", "Inactive", "Closed", "Completed", "Rejected", "Removed" }; witd = wit.Export(true); gatherNextStates(); findDonePath(); }
private List <State> GetStates(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemType workItemType) { string.Format("Getting TFS States for work item type '{0}'", workItemType.Name).Debug(); var states = new SortedList <string, State>(); var workItemTypeXml = workItemType.Export(false); var transitionsList = workItemTypeXml.GetElementsByTagName("TRANSITIONS"); var transitions = transitionsList[0]; foreach (XmlNode transition in transitions) { if (transition.Attributes == null) { continue; } if (transition.Attributes["to"] != null) { var toState = transition.Attributes["to"].Value; if (!string.IsNullOrEmpty(toState) && !states.ContainsKey(toState)) { states.Add(toState, new State(toState)); } } if (transition.Attributes["from"] != null) { var fromState = transition.Attributes["from"].Value; if (!string.IsNullOrEmpty(fromState) && !states.ContainsKey(fromState)) { states.Add(fromState, new State(fromState)); } } } return(states.Values.ToList()); }