Ejemplo n.º 1
0
        public void Execute(object parameter)
        {
            var dlg = new EditCategoryWindow();

            if (dlg.ShowDialog() == true && !string.IsNullOrEmpty(dlg.CategoryName))
            {
                var category = new Category(dlg.CategoryName, dlg.Color, dlg.Patterns);
                _mainPresentation.AddCategory(category);
            }
        }
        public void Execute(object parameter)
        {
            var selectedExpenses = _mainPresentation.SelectedExpenses;

            if (!selectedExpenses.Any())
            {
                return;
            }

            var recipients = selectedExpenses.Select(e => e.Recipient);

            var dlg = new EditCategoryWindow {
                CategoryName = "",
                Patterns     = recipients.ToArray()
            };

            if (dlg.ShowDialog() == true && !string.IsNullOrEmpty(dlg.CategoryName))
            {
                var category = new Category(dlg.CategoryName, dlg.Color, dlg.Patterns);
                _mainPresentation.AddCategory(category);
            }
        }