public void DeleteCategory() { // TODO: Untestable, rewrite for unit testing. var categoryName = ActiveForm.GetCurrentSelectedCategoryName(); var selectedCategory = QueryCategory(categoryName); // Check if user tries to delete special categories (default and complete): if (selectedCategory.Name == Resources.CompletedTaskListText || selectedCategory.Name == Resources.DefaultTaskCategoryName) { messageBoxFactory.ShowMessageBox( EMessageBox.Standard, Resources.DeleteSpecialListErrorText, Settings.Default.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var result = messageBoxFactory.ShowMessageBox( EMessageBox.Standard, Resources.ConfirmCategoryDeleteMessage, Settings.Default.AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { // Remove selected category from display, settings and memory: ActiveForm.DeleteCategoryFromDisplay(selectedCategory); Settings.Default.Categories.Remove(selectedCategory.Name); Settings.Default.Save(); Categories.Remove(selectedCategory); // TODO: Remove category from storage! } }
public void HideCompletedTaskList() { var result = QueryCategory(Resources.CompletedTaskListText); ActiveForm.DeleteCategoryFromDisplay(result); }