예제 #1
0
        private void StartImport(object sender, RoutedEventArgs e)
        {
            if (pdfpath == null || pdfpath == "" || !File.Exists(pdfpath))
            {
                MessageBox.Show("You need to select an existing pdf file first.");
                return;
            }

            //default dpi of 300
            int dpi = 300;

            if ((bool)checkBoxIndividualDPI.IsChecked)
            {
                try
                {
                    dpi = Convert.ToInt32(inputDPI.Text);
                }
                catch
                {
                    Console.WriteLine("The individual dpi value was not convertable to an integer.");
                }
            }

            if ((bool)checkBoxIndividualMapping.IsChecked)
            {
                try
                {
                    int pdfStart      = Convert.ToInt32(inputFirstPdf.Text);
                    int stageStart    = Convert.ToInt32(inputFirstStage.Text);
                    int numberOfPages = Convert.ToInt32(inputLastPdf.Text) - pdfStart + 1;

                    //Convert page and stage number to indexes
                    pdfStart--;
                    stageStart--;


                    presHandling.performImportPdf(pdfpath, dpi, pdfStart, stageStart, numberOfPages);
                    this.Close();
                }
                catch
                {
                    MessageBox.Show("The input strings for the advanced settings have not the correct format. Only integers are allowed.");
                }
            }
            else
            {
                presHandling.performImportPdf(pdfpath, dpi);
                this.Close();
            }
        }