Exemple #1
0
        private void InitializeButtons()
        {
            var buttons = new ButtonsImproved();
            var k       = 0;

            foreach (var item in ButtonsImproved.getList())
            {
                if (item.Name != ButtonsImproved.names.image.ToString() &&
                    item.Name != ButtonsImproved.names.image_delete.ToString())
                {
                    item.Location = new Point(13 + item.Width * k, 520);
                    k++;
                    selectAndAddEvent(item);
                    Controls.Add(item);
                }
            }

            var button = ButtonsImproved.getList().Find(x => x.Name == ButtonsImproved.names.image.ToString());

            button.Location = new Point(583, 143);

            selectAndAddEvent(button);
            Controls.Add(button);

            button          = ButtonsImproved.getList().Find(x => x.Name == ButtonsImproved.names.image_delete.ToString());
            button.Location = new Point(583, 113);
            button.Enabled  = false;

            selectAndAddEvent(button);
            Controls.Add(button);
        }
Exemple #2
0
        private void fillForm()
        {
            var textbox = TextboxesNames.getTextBoxByName(TextboxesNames.names.name);

            textbox.Text = (item != null) ? item.name : null;
            setTextboxesErrors(textbox);

            textbox      = TextboxesNames.getTextBoxByName(TextboxesNames.names.description);
            textbox.Text = (item != null) ? item.description : null;

            var combo = ComboboxesImproved.getComboboxByName(ComboboxesImproved.names.category);

            combo.SelectedItem = (item != null) ? queries.getCategoryById(item.id_category) : null;
            setComboboxesErrors(combo);

            combo = ComboboxesImproved.getComboboxByName(ComboboxesImproved.names.room);
            combo.SelectedItem = (item != null) ? queries.getRoomByShelfId(item.id_shelf) : null;
            setComboboxesErrors(combo);

            combo = ComboboxesImproved.getComboboxByName(ComboboxesImproved.names.wardrobe);
            combo.SelectedItem = (item != null) ? queries.getWardrobeByShelfId(item.id_shelf) : null;
            setComboboxesErrors(combo);

            combo = ComboboxesImproved.getComboboxByName(ComboboxesImproved.names.shelf);
            combo.SelectedItem = (item != null) ? queries.getShelfById(item.id_shelf) : null;
            setComboboxesErrors(combo);

            combo = ComboboxesImproved.getComboboxByName(ComboboxesImproved.names.status);
            combo.SelectedItem = (item != null) ? queries.getStatusById(item.id_status) : null;
            setComboboxesErrors(combo);

            var trackbar = TrackbarImproved.getTrackbar();

            trackbar.Value = (item != null) ? item.size : 0;
            setTrackbarErrors(trackbar);

            if (item != null && item.image != null)
            {
                pictureBox1.Image = Classes.ImageConverter.dbImgaeToImage(item.image);
                oryginalImage     = (Bitmap)pictureBox1.Image;
                var button = ButtonsImproved.getList().Find(x => x.Name == ButtonsImproved.names.image_delete.ToString());
                button.Enabled = true;
            }
            else
            {
                var button = ButtonsImproved.getList().Find(x => x.Name == ButtonsImproved.names.image_delete.ToString());
                button.Enabled    = false;
                pictureBox1.Image = null;
                oryginalImage     = null;
            }
            fillHistoryGrid(historyDataGridView);
            //this.checkBox1.Checked = item.deleted ? false : true;
        }
Exemple #3
0
        private void addImage_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = "Image files| *.jpg; *.jpeg; *.png";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var image = new Bitmap(dialog.FileName);
                image             = ImageDataBase.chnageImageSize(image);
                pictureBox1.Image = image;
                oryginalImage     = image;
                var button = ButtonsImproved.getList().Find(x => x.Name == ButtonsImproved.names.image_delete.ToString());
                button.Enabled = true;
            }
        }