From fbdbf5153441d31ca7dec21fe6d84eb4d8391e67 Mon Sep 17 00:00:00 2001 From: Joerg Battermann Date: Fri, 3 Feb 2012 14:22:56 +0100 Subject: [PATCH] fixed refresh problem & closes #1 --- JB.Tfs.Common/GlobalListCollection.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/JB.Tfs.Common/GlobalListCollection.cs b/JB.Tfs.Common/GlobalListCollection.cs index 99ee056..38b557f 100644 --- a/JB.Tfs.Common/GlobalListCollection.cs +++ b/JB.Tfs.Common/GlobalListCollection.cs @@ -16,7 +16,6 @@ namespace JB.Tfs.Common public class GlobalListCollection : IList { private readonly List _globalListCollection = new List(); - private XmlDocument _xmlDocument; private const string ProcessingInstructionData = "version='1.0' encoding='utf-8'"; private const string ProcessingInstructionTarget = "xml"; @@ -42,9 +41,11 @@ public GlobalListCollection(WorkItemStore workItemStore) private void FetchDataFromTeamFoundationServer(WorkItemStore workItemStore) { if (workItemStore == null) throw new ArgumentNullException("workItemStore"); - _xmlDocument = GetOrCreateGlobalListsXmlDocument(workItemStore); - foreach (var globalListXmlElement in GetGlobalListXmlElements(_xmlDocument)) + // remove previously fetched entries + _globalListCollection.Clear(); + + foreach (var globalListXmlElement in GetGlobalListXmlElements(GetOrCreateGlobalListsXmlDocument(workItemStore))) { _globalListCollection.Add(new GlobalList(globalListXmlElement)); } @@ -61,7 +62,6 @@ private IEnumerable GetGlobalListXmlElements(XmlDocument xmlDocument if (globalListsElement == null) throw new XmlException("GlobalList contains no proper root element."); - return (from XmlNode element in globalListsElement.ChildNodes where element.LocalName == GlobalListIdentifier select element as XmlElement);