// Factory Methods
 public static FolderBrowserDialogEx PrinterBrowser()
 {
     FolderBrowserDialogEx x = new FolderBrowserDialogEx();
     // avoid MBRO comppiler warning when passing _rootFolderLocation as a ref:
     x.BecomePrinterBrowser();
     return x;
 }
        private void openDirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string _folderName = @"C:\";
            _folderName = (System.IO.Directory.Exists(_folderName)) ? _folderName : "";
            var dlg1 = new FolderBrowserDialogEx
            {
                Description = "Select a folder for the extracted files:",
                ShowNewFolderButton = true,
                ShowEditBox = true,
                //NewStyle = false,
                SelectedPath = _folderName,
                ShowFullPathInEditBox = false,
            };
            dlg1.RootFolder = System.Environment.SpecialFolder.MyComputer;
            var result = dlg1.ShowDialog();

            string strBathStateFile = "";//记录当前目录下的BatchState.xml文件

            if (result == DialogResult.OK)
            {
                strWorkingDir = Path.GetFullPath(dlg1.SelectedPath);
                strBathStateFile = strWorkingDir + "\\BatchState.xml";
            }
            else
            {
                return;
            }

            //if (File.Exists(strBathStateFile))
            //{
            //    DataEntryForm.logger.Info("*****************************************************************");
            //    DataEntryForm.logger.Info("继续上次batch");
            //    DataEntryForm.logger.Info("*****************************************************************");
            //    DialogResult DiaResult = new DialogResult();
            //    DiaResult = MessageBox.Show("Do you want to continue the Batch? ", "Proofer", MessageBoxButtons.YesNo);
            //    BatchEngine engine = new BatchEngine(strWorkingDir, false);

            //    if (DiaResult == DialogResult.Yes)
            //    {
            //        int nTotal = engine.GetAllFile().Count;
            //        int nUndo = engine.GetAllFileUndo().Count;
            //        MessageBox.Show("You will do \t" + nUndo + "\nTotal number \t" + nTotal);
            //        listImagePath = engine.GetAllFileUndo();
            //        if (listImagePath.Count == 0)
            //        {
            //            MessageBox.Show("This batch is closed.");
            //            return;
            //        }
            //    }
                //else
            //    {
            //        DataEntryForm.logger.Info("*****************************************************************");
            //        DataEntryForm.logger.Info("打开一个新batch");
            //        DataEntryForm.logger.Info("*****************************************************************");
            //        listImagePath = DirectoryReader.GetFiles(strWorkingDir, strImageConfig, false);
            //        if (listImagePath.Count > 0)
            //        {
            //            _batchEngine = new BatchEngine(strWorkingDir, true);
            //        }
            //    }
            //}
            //else//该目录下没有BatchState.xml
            {
                DataEntryForm.logger.Info("*****************************************************************");
                DataEntryForm.logger.Info("打开一个新batch");
                DataEntryForm.logger.Info("*****************************************************************");
                listImagePath = DirectoryReader.GetFiles(strWorkingDir, strImageConfig, false);
                //if (listImagePath.Count > 0)
                //{
                //    _batchEngine = new BatchEngine(strWorkingDir, false);
                //}
            }
            LogInfo.nTotalPage = listImagePath.Count;
            DataEntryForm.logger.Info("总页数:\t" + LogInfo.nTotalPage);
            LogInfo.dtSoftWareStartTime = DateTime.Now;//加载完成后开始及时

            if (listImagePath.Count == 0)
            {
                MessageBox.Show("Image's path must contain:\t" + strImageConfig);
                return;
            }

            if (listImagePath.Count > 0)
            {
                if (_nCurrentImageIndex < listImagePath.Count && _nCurrentImageIndex >= 0)
                {
                    processOneImage(listImagePath[_nCurrentImageIndex].ToString());
                }
            }
        }