Exemple #1
0
        private void ListBoxItem_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            Category    _sender     = (Category)((ContentControl)sender).Content;
            NewCategory newCategory = new NewCategory(_sender);

            newCategory.Owner = this;

            if (newCategory.ShowDialog() == true)
            {
                if (newCategory.Action == Action.Delete)
                {
                    deleteCategory(_sender);
                }
                else if (newCategory.Action == Action.OK)
                {
                    _sender.Name  = newCategory.nameTextBox.Text;
                    _sender.Color = ((SolidColorBrush)newCategory.colorPicker.SelectedColor).Color;
                    updateCategory(_sender);
                }
            }

            if (newCategory.Action != Action.Cancel)
            {
                Load();
            }
        }
Exemple #2
0
        private void newButton_Click(object sender, RoutedEventArgs e)
        {
            NewCategory category = new NewCategory();

            category.Owner = this;

            if (category.ShowDialog() == true)
            {
                Category c = new Category();
                c.Name  = category.nameTextBox.Text;
                c.Color = ((SolidColorBrush)category.colorPicker.SelectedColor).Color;

                addCategory(c);
                Load();
            }
        }