Example #1
0
        /// <summary>
        /// Löscht eine bestehende Kategorie und deren Links
        /// </summary>
        /// <param name="category"></param>
        public static void DeleteCategory(Category category)
        {
            var result = MessageBox.Show(CommonText.CategoryDeleteQuestion, CommonText.CategoryDeleteTitle,MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result != MessageBoxResult.Yes)
                return;

            var categoryLinks = DataStore.Instance.Links.Where(li => li.Category.Id.Equals(category.Id)).ToList();
            DataStore.Instance.OnLinksDeleted(categoryLinks);

            if (DataStore.Instance.Categories.Any(cat => cat.Guid.Equals(category.Guid)))
                DataStore.Instance.OnCategoriesDeleted(category.WrapInList());
        }
Example #2
0
 /// <summary>
 /// Ändert eine bestehende Kategorie
 /// </summary>
 /// <param name="category"></param>
 public static void EditCategory(Category category)
 {
     if (DataStore.Instance.Categories.Any(cat => cat.Guid.Equals(category.Guid)))
         DataStore.Instance.OnCategoriesChanged(category.WrapInList());
 }
Example #3
0
 /// <summary>
 /// Fügt eine Kategorie hinzu
 /// </summary>
 /// <param name="category"></param>
 public static void AddCategory(Category category)
 {
     if (!DataStore.Instance.Categories.Any(cat => cat.Name.Equals(category.Name)))
             DataStore.Instance.OnCategoriesAdded(category.WrapInList());
 }
Example #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="category"></param>
        /// <param name="isExpanded"></param>
        private void SetCategoryViewState(Category category, bool isExpanded)
        {
            if (category.IsExpanded == isExpanded)
                return;

            category.IsExpanded = isExpanded;
            DataStore.Instance.OnCategoriesChanged(category.WrapInList());
        }