Ejemplo n.º 1
0
        private void pidBrowseButton_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "PDF|*.pdf";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                pIDPathTextBox.Text = openFileDialog1.FileName;

                if (MessageBox.Show("Do You Want To Convert This PDF File?", "Convert", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    var img    = new byte[0];
                    var thread = new Thread(
                        () =>
                    {
                        img = ConvertPDF2Image(_mainFormUnit.PIDPath);
                    });
                    thread.Start();
                    lblConverting.Text = "Converting\nPlease Wait...";
                    thread.Join();
                    lblConverting.Text = "";
                    Bitmap src = (Bitmap)((new ImageConverter()).ConvertFrom(img));
                    pictureBox1.Image = src;
                    string OutputPath = Application.StartupPath + @"\Data\Temp";
                    if (!Directory.Exists(OutputPath))
                    {
                        Directory.CreateDirectory(OutputPath);
                    }
                    new Bitmap(pictureBox1.Image).Save(OutputPath + "\\" + Path.GetFileNameWithoutExtension(_mainFormUnit.PIDPath) + ".jpg", ImageFormat.Jpeg);
                    //MessageBox.Show("Convert Completed");
                    lblConverting.Text    = "Convert Completed";
                    imagePathTextBox.Text = OutputPath + "\\" + Path.GetFileNameWithoutExtension(_mainFormUnit.PIDPath) + ".jpg";
                    ImageBrowseButton.Focus();
                }
            }
        }
Ejemplo n.º 2
0
        public void AddImageToGallery(string imageTitle, string imageType, string imageFilePath)
        {
            AddImageLink = LoadClickableElement(nameof(AddImageLink));
            AddImageLink.Click();

            ImageTitleText    = LoadElement(nameof(ImageTitleText));
            ImageTypeSelect   = LoadElement(nameof(ImageTypeSelect));
            ImageBrowseButton = LoadElement(nameof(ImageBrowseButton));
            SubmitImageButton = LoadElement(nameof(SubmitImageButton));

            ImageTitleText.SendKeys(imageTitle);
            var imageTypeSelect = new SelectElement(ImageTypeSelect);

            imageTypeSelect.SelectByText(imageType);
            ImageBrowseButton.SendKeys(imageFilePath);
            SubmitImageButton.Click();
        }