0
TFS API 2010에서 작업하고 있습니다.TFS 옵션 필드의 옵션 목록을 얻는 방법은 무엇입니까?
필드의 옵션 목록을 사용하여 Combobox 컨트롤을 만들고 싶습니다.
우선 순위 -> [1,2,3,4] 심각도 -> [ '4-low', '3-medium', '2-height', '1- Critical']
TFS API 2010에서 작업하고 있습니다.TFS 옵션 필드의 옵션 목록을 얻는 방법은 무엇입니까?
필드의 옵션 목록을 사용하여 Combobox 컨트롤을 만들고 싶습니다.
우선 순위 -> [1,2,3,4] 심각도 -> [ '4-low', '3-medium', '2-height', '1- Critical']
TFS에서 WorkItemType Definition을 내 보낸 다음 xml에서 해당 필드를 찾아 여기에서 값을 사용해야합니다. 다음은 전환 목록을 가져 오는 데 사용 된 코드 스 니펫입니다. 옵션이 전역 목록에 있다고 생각하면 내보내기 방법의 플래그를 true로 설정합니다.
public List<Transition> GetTransistions(WorkItemType workItemType)
{
List<Transition> currentTransistions;
// See if this WorkItemType has already had it's transistions figured out.
this._allTransistions.TryGetValue(workItemType, out currentTransistions);
if (currentTransistions != null)
{
return currentTransistions;
}
// Get this worktype type as xml
XmlDocument workItemTypeXml = workItemType.Export(false);
// Create a dictionary to allow us to look up the "to" state using a "from" state.
var newTransitions = new List<Transition>();
// get the transitions node.
XmlNodeList transitionsList = workItemTypeXml.GetElementsByTagName("TRANSITIONS");
// As there is only one transitions item we can just get the first
XmlNode transitions = transitionsList[0];
// Iterate all the transitions
foreach (XmlNode transition in transitions)
{
// save off the transition
newTransitions.Add(new Transition { From = transition.Attributes["from"].Value, To = transition.Attributes["to"].Value });
}
// Save off this transition so we don't do it again if it is needed.
this._allTransistions.Add(workItemType, newTransitions);
return newTransitions;
}
전환은 다음과 같이 작습니다.
public class Transition
{
#region Public Properties
public string From { get; set; }
public string To { get; set; }
#endregion
}