private void CategoryNew() { try { // Edit a new category in a Category form. Category new_category = new Category(); CategoryForm form = new CategoryForm(Lang, new_category); DialogResult res = form.ShowDialog(); // If the category has been modified, save it to the DB. if (res != DialogResult.OK) return; new_category.Update(); // Save task in DB // Add category and update the category bar Todomoo.Categories.Add(new_category); RedrawCategoriesBar(); SelectedCategory = new_category; CountTasks(); } catch { Utils.MsgDialog.Error(Lang.Get("task_save_error"), Lang.Get("error")); return; } }
private void CategoryEditSelected() { if (SelectedCategory == null) return; try { // Edit the selected category in a Category form. Category edit_category = SelectedCategory; CategoryForm form = new CategoryForm(Lang, edit_category); DialogResult res = form.ShowDialog(); // If the category has been modified, save it to the DB. if (res != DialogResult.OK) return; edit_category.Update(); // Save task in DB // Update the category bar RedrawCategoriesBar(); } catch { Utils.MsgDialog.Error(Lang.Get("task_save_error"), Lang.Get("error")); return; } }