private void FileWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            int insertIndex = -1, skippedFiles = 0;
            PdfFile pdfFile = null;

            object[] args = (object[])e.Argument;
            string[] fileNames = (string[])args[0];
            if (args.Length == 2)
            {
                insertIndex = int.Parse(args[1].ToString());
            }

            foreach (string fileName in fileNames)
            {
                fileBackgroundWorker.ReportProgress(0, string.Format("Loading PDF file: {0}", fileName));
                pdfFile = new PdfFile(fileName);
                int status = pdfFile.Open();

                if (status == Define.Success || status == Define.BadPasswordException)
                {
                    if (insertIndex == -1)
                    {
                        App.Current.Dispatcher.Invoke(delegate () { PdfFiles.Add(pdfFile); });
                    }
                    else
                    {
                        App.Current.Dispatcher.Invoke(delegate () { PdfFiles.Insert(insertIndex, pdfFile); });
                        insertIndex++;
                    }
                }
                else
                {
                    skippedFiles++;
                }
            }
            e.Result = new object[] { skippedFiles, insertIndex };
        }
        private void FileWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            string fileName = e.Argument.ToString();

            PdfFile pdfFile = new PdfFile(fileName);
            int status = pdfFile.Open();

            if (status == Define.Success ||
                status == Define.BadPasswordException)
            {
                App.Current.Dispatcher.Invoke(delegate ()
                {
                    PdfFiles.Add(pdfFile);
                    SelectedFile = PdfFiles.First();
                });
            }
            else
            {
                e.Result = pdfFile.ErrorMsg;
            }
        }