Пример #1
0
        private void pictureBoxUser_Click(object sender, EventArgs e)
        {
            var image = ImageMethod.GetDirectoryImage();

            this.pictureBoxUser.Image = image;
            _userStruct.binary        = (image != null) ? ImageMethod.ImageToBinary(image) : null;
        }
Пример #2
0
        public override bool Change(ImageMethod method)
        {
            using Form form = new Form();
            TableLayoutPanel tlp = new TableLayoutPanel
            {
                RowCount    = 2,
                ColumnCount = 2,
                Dock        = DockStyle.Fill,
                Parent      = form
            };

            tlp.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
            tlp.RowStyles.Add(new RowStyle(SizeType.Absolute, 30));
            tlp.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50));
            tlp.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50));
            PropertyGrid pg = new PropertyGrid {
                Dock = DockStyle.Fill, SelectedObject = method
            };

            tlp.Controls.Add(pg, 0, 0);
            tlp.SetColumnSpan(pg, 2);
            Button ok = new Button {
                Text = "OK", Dock = DockStyle.Fill, DialogResult = DialogResult.OK
            };
            Button cancel = new Button {
                Text = "Отмена", Dock = DockStyle.Fill, DialogResult = DialogResult.Cancel
            };

            tlp.Controls.Add(ok, 0, 1);
            tlp.Controls.Add(cancel, 1, 1);

            return(form.ShowDialog() == DialogResult.OK);
        }
Пример #3
0
        public override bool Change(ImageMethod method)
        {
            using Form form = new Form();
            TableLayoutPanel tlp = new TableLayoutPanel
            {
                RowCount    = 3,
                ColumnCount = 2,
                Dock        = DockStyle.Fill,
                Parent      = form
            };

            tlp.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
            tlp.RowStyles.Add(new RowStyle(SizeType.Absolute, 30));
            tlp.RowStyles.Add(new RowStyle(SizeType.Absolute, 30));
            tlp.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50));
            tlp.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50));
            PropertyGrid pg = new PropertyGrid {
                Dock = DockStyle.Fill, SelectedObject = method
            };

            tlp.Controls.Add(pg, 0, 0);
            tlp.SetColumnSpan(pg, 2);
            Button preview = new Button {
                Text = "Предпросмотр", Dock = DockStyle.Fill
            };
            Button ok = new Button {
                Text = "OK", Dock = DockStyle.Fill, DialogResult = DialogResult.OK
            };
            Button cancel = new Button {
                Text = "Отмена", Dock = DockStyle.Fill, DialogResult = DialogResult.Cancel
            };

            tlp.Controls.Add(preview, 0, 1);
            tlp.SetColumnSpan(preview, 2);
            tlp.Controls.Add(ok, 0, 2);
            tlp.Controls.Add(cancel, 1, 2);

            preview.Click += (_, __) =>
            {
                try
                {
                    IMatrixImage image = method.Invoke((IMatrixImage)ImageLib.Controller.MainController.CurrentController.CurrentImage.Clone());
                    ImageLib.Controller.MainController.CurrentController.SetPreviewImage(image);
                }
                catch (System.Reflection.TargetInvocationException targetEx)
                {
                    MessageBox.Show($"{targetEx.Message}{Environment.NewLine}{targetEx.InnerException.Message}",
                                    targetEx.InnerException.GetType().Name);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ex.GetType().Name);
                }
            };

            return(form.ShowDialog() == DialogResult.OK);
        }
Пример #4
0
 private void FillForm()
 {
     if (_statusUpdate == true)
     {
         Text = "Изменение пользователя: " + _userStruct.login;
         comboBoxLevel.Text   = _userStruct.levelName;
         textBoxName.Text     = _userStruct.name;
         textBoxSurname.Text  = _userStruct.surname;
         textBoxLogin.Text    = _userStruct.login;
         pictureBoxUser.Image = (_userStruct.binary != null) ? ImageMethod.BinaryToImage(_userStruct.binary) : null;
     }
 }
Пример #5
0
        private void LaunchButton_Click(object sender, EventArgs e)
        {
            var matrix    = GetMatrix();
            var method    = new BranchAndBoundMethod(matrix, matrix.GetLength(0));
            var results   = method.Start();
            var imageDraw = new ImageMethod(results);

            outputPictureBox.Image = imageDraw.GenetateImage(outputPictureBox.Width, outputPictureBox.Height);
            foreach (var result in results)
            {
                outputTextBox.AppendText(result.ToResultString());
            }
        }
Пример #6
0
        private void pictureBoxUser_Click(object sender, EventArgs e)
        {
            try
            {
                var image = ImageMethod.GetDirectoryImage();

                _userStruct.binary = (image != null) ? ImageMethod.ImageToBinary(image) : null;

                pictureBoxUser.Image = image;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #7
0
 private void FillForm()
 {
     this.Text += _userStruct.login;
     this.textBoxLogin.Text       = _userStruct.login;
     this.textBoxLevel.Text       = _userStruct.levelName;
     this.textBoxName.Text        = _userStruct.name;
     this.textBoxSurname.Text     = _userStruct.surname;
     this.textBoxProject.Text     = DataMethod.CountFiles(_userStruct.userId, StatusFile.Project).ToString();
     this.textBoxReview.Text      = DataMethod.CountFiles(_userStruct.userId, StatusFile.Review).ToString();
     this.textBoxDraft.Text       = DataMethod.CountFiles(_userStruct.userId, StatusFile.Draft).ToString();
     this.textBoxAllFiles.Text    = DataMethod.CountFiles(_userStruct.userId, StatusFile.My).ToString();
     this.textBoxSizeFiles.Text   = FileMethod.FileSize(DataMethod.SizeAllFiles(_userStruct.userId));
     this.textBoxDatetimeAT.Text  = _userStruct.dateTimeAT.ToString();
     this.pictureBoxUser.SizeMode = PictureBoxSizeMode.StretchImage;
     this.pictureBoxUser.Image    = (_userStruct.binary != null) ? ImageMethod.BinaryToImage(_userStruct.binary) : null;
 }
Пример #8
0
 private void FillForm()
 {
     try
     {
         Text = "Свойства пользователя: " + _userStruct.login;
         textBoxLogin.Text       = _userStruct.login;
         textBoxLevel.Text       = _userStruct.levelName;
         textBoxName.Text        = _userStruct.name;
         textBoxSurname.Text     = _userStruct.surname;
         textBoxProject.Text     = DataMethod.CountFiles(_userStruct.userId, StatusFileEnum.Project).ToString();
         textBoxDraft.Text       = DataMethod.CountFiles(_userStruct.userId, StatusFileEnum.Draft).ToString();
         textBoxAllFiles.Text    = DataMethod.CountFiles(_userStruct.userId, StatusFileEnum.My).ToString();
         textBoxSizeFiles.Text   = FileMethod.FileSize(DataMethod.SizeAllFiles(_userStruct.userId));
         textBoxDatetimeAT.Text  = _userStruct.dateTimeAT.ToString();
         pictureBoxUser.SizeMode = PictureBoxSizeMode.StretchImage;
         pictureBoxUser.Image    = (_userStruct.binary != null) ? ImageMethod.BinaryToImage(_userStruct.binary) : null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #9
0
 public ImageHistory(ImageMethod method, IMatrixImage image, string message)
 {
     methodData = CreateByteData(method);
     imageData  = CreateByteData(image);
     Message    = message;
 }
Пример #10
0
 public ImageHistory(ImageMethod method, string message)
 {
     methodData = CreateByteData(method);
     Message    = message;
 }