예제 #1
0
        public ReceiptEditor()
        {
            InitializeComponent();

            ReceiptEditor.ImageCategories = ImageCategory.LoadImageCategories();
            ReceiptEditor.FilesSharded    = 0;
        }
예제 #2
0
        public ImageEditForm(int subImageId, Action <ImageAttributes> editCallback, Func <Bitmap> getImageCallback, Action <int> rotateAction, Action hideCallback)
        {
            InitializeComponent();
            this.Text = $"Categorization - {subImageId}";

            imageCategories             = ImageCategory.LoadImageCategories(); // Silly reloading to avoid touching the original.
            this.categoryBox.DataSource = imageCategories;

            this.editCallback     = editCallback;
            this.getImageCallback = getImageCallback;
            this.rotateAction     = rotateAction;
            this.hideCallback     = hideCallback;
        }
예제 #3
0
        private void addCategoryButton_Click(object sender, EventArgs e)
        {
            ImageCategory category = new ImageCategory()
            {
                Name   = this.newCategoryName.Text,
                Folder = this.newCategoryFolder.Text
            };

            // TODO: This only updates the current subimage window.
            ReceiptEditor.ImageCategories.Add(category);
            ReceiptEditor.ImageCategories.Sort((left, right) => left.Name.CompareTo(right.Name));

            categoryBox.DataSource   = null;
            categoryBox.DataSource   = ReceiptEditor.ImageCategories;
            categoryBox.SelectedItem = category;

            ImageCategory.SaveImageCategories(ReceiptEditor.ImageCategories);
            imageCategories = ImageCategory.LoadImageCategories();
        }