Пример #1
0
        private void LoadSettings(DemoOptions options)
        {
            _tbSourceDirectory.Text = options.SourceDirectory != null?options.SourceDirectory.Trim() : string.Empty;

            _tbFilter.Text = options.SourceFilter != null?options.SourceFilter.Trim() : string.Empty;

            _tbDestinationDirectory.Text = options.DestinationDirectory != null?options.DestinationDirectory.Trim() : string.Empty;

            string formatName = options.DestinationDocumentFormat.ToString();

            SelectFormatByName(formatName);

            if (string.IsNullOrEmpty(_tbSourceDirectory.Text))
            {
                _tbSourceDirectory.Text = Path.GetFullPath(DemosGlobal.ImagesFolder);
            }

            if (string.IsNullOrEmpty(_tbDestinationDirectory.Text))
            {
                _tbDestinationDirectory.Text = Path.Combine(Path.GetFullPath(DemosGlobal.ImagesFolder), @"MultiThreadedDemoImages");
            }

            if (string.IsNullOrEmpty(_tbFilter.Text))
            {
                _tbFilter.Text = "*.tif";
            }
        }
Пример #2
0
        public void SaveSettings()
        {
            // Save the last setting
            DemoOptions options = new DemoOptions();

            options.OcrEngineType             = _ocrEngineType;
            options.SourceDirectory           = _tbSourceDirectory.Text.Trim();
            options.SourceFilter              = _tbFilter.Text.Trim();
            options.DestinationDirectory      = _tbDestinationDirectory.Text.Trim();
            options.DestinationDocumentFormat = _documentFormatSelector.SelectedFormat;

            options.SaveDefault();
        }
Пример #3
0
        public void Init(OcrEngineType ocrEngineType, DocumentWriter docWriter, DemoOptions options, int totalPages)
        {
            _ocrEngineType = ocrEngineType;
            _totalPages    = totalPages;

            SetDocumentWriterOptions(docWriter);
            _documentFormatSelector.SetDocumentWriter(docWriter, true);
            _documentFormatSelector.SetOcrEngineType(_ocrEngineType);

            InitFormats();

            LoadSettings(options);

            UpdateMyControls();
        }
Пример #4
0
        public static DemoOptions LoadDefault()
        {
            DemoOptions options = new DemoOptions();

            string xmlFileName = GetXmlFileName();

            if (File.Exists(xmlFileName))
            {
                try
                {
                    using (StreamReader reader = File.OpenText(xmlFileName))
                    {
                        options = _serializer.Deserialize(reader) as DemoOptions;
                    }
                }
                catch
                {
                }
            }

            return(options);
        }
Пример #5
0
        private void Startup()
        {
            DemoOptions options = DemoOptions.LoadDefault();

            // Show the engine selection dialog
            using (OcrEngineSelectDialog dlg = new OcrEngineSelectDialog(Messager.Caption, options.OcrEngineType.ToString(), false))
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    _docWriter = new DocumentWriter();
                    _gatherInformationControl.Init(dlg.SelectedOcrEngineType, _docWriter, options, 1);

                    // Add the selected engine name to the demo caption
                    Text = Text + " [" + dlg.SelectedOcrEngineType.ToString() + " Engine]";
                }
                else
                {
                    // Close the demo
                    Close();
                }
            }
        }