private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     pdf = new PDFDoc();
     //Открываем файл
     bool openResult = pdf.OpenPDF(PdfDocumentOpenMode.Modify);
     if (!openResult) this.DialogResult=false;
 }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     pdf = new PDFDoc();
     //Открываем файл
     bool openResult = pdf.OpenPDF(PdfDocumentOpenMode.Modify);
     if (openResult)
     {
         lblPageAmount.Content += pdf.PagesCount.ToString();
     }
     else
     {
         this.DialogResult=false;
     }
 }
        PDFDoc outPdf; //output pdf file

        #endregion Fields

        #region Constructors

        public MergeWindow()
        {
            InitializeComponent();
            outPdf = new PDFDoc();
        }