public void Delete() { if (this.IsEditing) { return; // ignore del key when editing. } Category c = this.Selected; if (c != null) { IList <Transaction> data = this.MyMoney.Transactions.GetTransactionsByCategory(c, null); if (data.Count > 0) { var dialog = new MergeCategoryDialog() { Money = this.MyMoney, SourceCategory = c }; dialog.FontSize = this.FontSize; dialog.Owner = App.Current.MainWindow; dialog.Title = "Delete Category"; if (dialog.ShowDialog() == false || dialog.SelectedCategory == null) { return; } Merge(c, dialog.SelectedCategory); } else { c.OnDelete(); } } }
private void OnMergeCategory(object sender, ExecutedRoutedEventArgs e) { Category c = this.Selected; if (c != null) { var d = new MergeCategoryDialog() { Money = this.money, SourceCategory = c }; d.Owner = App.Current.MainWindow; d.FontSize = this.FontSize; if (d.ShowDialog() == true && d.SelectedCategory != null) { Merge(c, d.SelectedCategory); } } }