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; } }