private void BtnCreateCategory_Click(object sender, RoutedEventArgs e) { CategoryWindow categoryWindow = new CategoryWindow(); categoryWindow.Show(); categoryWindow.Closing += CategoryWindow_Closing; }
private void CategoryWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { CategoryWindow categoryWindow = new CategoryWindow(); if (categoryWindow != null) { categoryWindow.Closing -= CategoryWindow_Closing; } InitializeCategories(); }
private void BtnEditCategory_Click(object sender, RoutedEventArgs e) { OperationTypeDto category = GetClickedCategory(sender); CategoryWindow categoryWindow = new CategoryWindow(); categoryWindow.Id = category.Id; categoryWindow.tbCategoryName.Text = category.Name; if (category.IsCredit) { categoryWindow.rbIncome.IsChecked = true; } else { categoryWindow.rbExpense.IsChecked = true; } categoryWindow.Show(); categoryWindow.Closing += CategoryWindow_Closing; }