Exemple #1
0
        private void Startup()
        {
            try
            {
                //Check if ocr engine was passed in. The recognition demos have the ability to launch this demo and it will pass
                //the ocr engine it is using. We will default to that engine
                if (!StartUpEngines())
                {
                    Messager.ShowError(this, "One or more required engines did not start. The application will now close.");
                    this.Close();
                    return;
                }

                Messager.Caption = "LEADTOOLS Business Card Reader";
                _bcrReader       = new BusinessCardReader(_ocrEngine, _barcodeEngine);
            }
            catch (Exception exp)
            {
                Messager.ShowError(this, exp);
            }

            closeToolStripMenuItem.Enabled   = false;
            _noneInteractiveMode             = new ImageViewerNoneInteractiveMode();
            _panInteractiveMode              = new ImageViewerPanZoomInteractiveMode();
            _panInteractiveMode.MouseButtons = System.Windows.Forms.MouseButtons.Left;
            _zoomToInteractiveMode           = new ImageViewerZoomToInteractiveMode();

            rasterImageViewer1.InteractiveModes.BeginUpdate();
            rasterImageViewer1.InteractiveModes.Add(_noneInteractiveMode);
            rasterImageViewer1.InteractiveModes.Add(_panInteractiveMode);
            rasterImageViewer1.InteractiveModes.Add(_zoomToInteractiveMode);
            rasterImageViewer1.InteractiveModes.EndUpdate();

            this.rasterImageViewer1.PostRender += RasterImageViewer1_PostRender;

            // Load the default document
            string defaultDocumentFile = Path.Combine(DemosGlobal.ImagesFolder, "business_card_sample.jpg");

            if (File.Exists(defaultDocumentFile))
            {
                OpenImage(defaultDocumentFile);
            }
        }
Exemple #2
0
        public void Initialize()
        {
            try
            {
                IsLoading = true;

                // Set license
                if (!LicenseManagerUtility.SetLicense(this))
                {
                    return;
                }

                GetAppDirectory();

                BcReader = new BusinessCardReader(null, new BarcodeEngine());

                Task.Run(() =>
                {
                    CopyDependencies(APP_DIR);
                    StartOcrEngine();
                });

                CurrentAppData = new AppData();
                CurrentAppData.Load(Path.Combine(APP_DIR, AppData.DATA_FILE_NAME));
                CurrentAppData.PropertyChanged += CurrentAppData_PropertyChanged;

                //init collection and bind the list source to it
                LoadContactList();

                RefreshListView();
                DependencyService.Get <IPermissions>().VerifyPermissionsAsync(false, PermissionType.Camera);
            }
            finally
            {
                IsLoading = false;
            }
        }