Exemplo n.º 1
0
        public void CreateCategory(string category)
        {
            if (category == "Uncategorized")
            {
                throw new ArgumentException("Reserved category name");
            }

            _tagNamesByCategory.Add(category, new HashSet <string>());
            CategoriesChanged?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 2
0
        public void RemoveCategory(string category)
        {
            // TODO - Don't even let the user attempt to remove the uncategorized category...
            if (category == "Uncategorized")
            {
                throw new ArgumentException("Reserved category name");
            }

            // TODO - Are you sure dialog if category contains tags/videos
            foreach (var tag in GetTags(category))
            {
                tag.Category = null;
                _uncategorizedTagNames.Add(tag.Name);
            }

            _tagNamesByCategory.Remove(category);
            CategoriesChanged?.Invoke(this, EventArgs.Empty);
        }
        //-------------------------------------------------------------------------

        protected virtual void OnCategoriesChanged()
        {
            CategoriesChanged?.Invoke(this, EventArgs.Empty);
        }