/// <summary> /// Handler for clicking "new category" /// </summary> /// <param name="sender"></param> /// <param name="e">Event arguments</param> private void AddCategoryButton_Click(object sender, RoutedEventArgs e) { // Creating new dialog AddCategoryDialog catDialog = new AddCategoryDialog(); catDialog.Owner = this; bool?result = catDialog.ShowDialog(); // Handling result if (result == true) { Category tempCat = new Category(-1, catDialog.Category); int newId = SafeDatabase.AddCategoryToDataBase(tempCat); if (newId == -1) { return; } Category finalizedNewCategory = new Category(newId, catDialog.Category); categoriesList.Add(finalizedNewCategory); List <Category> tmpList = new List <Category>(); tmpList.Add(finalizedNewCategory); AddCategoriesToCombobox(tmpList); } }