Пример #1
0
        public Category OpenAddCategoryWindow()
        {
            AddCategoryWindow win = new AddCategoryWindow();

            if (win.ShowDialog() == true)
            {
                Category c = new Category()
                {
                    Name = win.category.Text,
                    Id   = "0"
                };
                return(c);
            }
            return(null);
        }
Пример #2
0
        private void AddCategory_Click()
        {
            // Open temporary add category form
            AddCategoryWindow form = new AddCategoryWindow();

            form.ShowDialog();

            // If category is valid, at it to the DB
            if (form.MViewModel.IsCategoryValid)
            {
                // Create category
                EZBudgetDB.CreateCategory(LogedInUserID, form.MViewModel.CategoryName,
                                          form.MViewModel.CategoryDescription, form.MViewModel.CategoryColorTag,
                                          Math.Round(decimal.Parse(form.MViewModel.CategoryAmount), 2));

                // TO BE CHANGED
                PopulateViewModel();
            }
        }
Пример #3
0
        private void AddCategory(object obj)
        {
            string category = "";
            if (obj.Equals("##Region") || obj.Equals("##Themes"))
            {

                var addCategoryWindow = new AddCategoryWindow();
                addCategoryWindow.ShowDialog();

                if (!addCategoryWindow.IsCancelled)
                {
                    category = addCategoryWindow.Category;

                    MenuItem menuItem = ViewHelper.CreateMenuItem(AddCategoryCommand, category);

                    if (obj.Equals("##Region"))
                    {
                        _regionsMenu.Items.Add(menuItem);
                    }
                    else
                    {
                        _themesMenu.Items.Add(menuItem);
                    }

                }

            }
            else
            {
                category = obj.ToString();
            }

            var articles = _articlesDataGrid.SelectedItems.OfType<Article>().ToList();
            _commandManager.AddCategory(articles, category);

            Refresh();
        }
Пример #4
0
        private void button_CategoriesAdd_Click(object sender, RoutedEventArgs e)
        {
            AddCategoryWindow popup = new AddCategoryWindow(this.DataContext);

            popup.ShowDialog();
        }
Пример #5
0
        public void AddCategory()
        {
            AddCategoryWindow window = new AddCategoryWindow();

            window.ShowDialog();
        }