Ejemplo n.º 1
0
        /// <summary>
        /// Remove a category from the list.
        /// </summary>
        /// <param name="cat"></param>
        public static void Remove(CategoryConfigInfo cat)
        {
            var items = LoadCategories();

            for (int i = 0; i < items.Count; i++)
            {
                if (items[i].MeetingList.UniqueString == cat.MeetingList.UniqueString)
                {
                    items.RemoveAt(i);
                    SaveCategories(items);
                    return;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Update or, if not there, insert the category.
        /// </summary>
        /// <param name="cat"></param>
        public static void UpdateOrInsert(CategoryConfigInfo cat)
        {
            bool found = false;
            var  items = LoadCategories();

            for (int i = 0; i < items.Count; i++)
            {
                if (items[i].MeetingList.UniqueString == cat.MeetingList.UniqueString)
                {
                    items[i] = cat;
                    found    = true;
                }
            }
            if (!found)
            {
                items.Add(cat);
            }
            SaveCategories(items);
        }