OIShoppingListWinPhone.DataModel.ShoppingList.UpdateListTags C# (CSharp) 메소드

UpdateListTags() 공개 메소드

Updating ShoppingList.Tags property. Calls when the ShoppingList.ListItems collection was changed and it's necessary to update list of unique list tags
public UpdateListTags ( ) : void
리턴 void
        public void UpdateListTags()
        {
            List<string> tags = new List<string>();
            //Enumerating all shopping list items and adding all
            //unique tags to Shoppingist.Tags List
            foreach (ShoppingListItem item in this.ListItems)
            {
                foreach (string tag in item.Tags)
                {
                    if (!tags.Contains(tag))
                        tags.Add(tag);
                }
            }
            tags.Sort();
            //Adding an '[Empty]' string to list for displaying in Custom Filter List Control
            tags.Insert(0, "Tag [Empty]");
            bTags = true;
            this.Tags = tags;
        }