OcrData implements a singleton that provides access to the photo and corresponding text obtained from OCR conversion. It inherits from ModelBase which means that interested parties can subscribe to its PropertyChanged. It also means that references to the singleton instance of type OcrData can be used in data binding syntax in XAML files.
Inheritance: GPS.Utils.ModelBase
コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the PhotoSelector class.
        /// </summary>
        public PhotoSelector()
        {
            InitializeComponent();

            this.ocrData = OcrData.Instance;
            this.cameraCaptureTask = new CameraCaptureTask();
            this.photoChooserTask = new PhotoChooserTask();

            this.cameraCaptureTask.Completed += new System.EventHandler<PhotoResult>(this.PhotoChooserCompleted);
            this.photoChooserTask.Completed += new EventHandler<PhotoResult>(this.PhotoChooserCompleted);
        }
コード例 #2
0
        private double photoAngle;          // Wrapped by this.PhotoAngle

        /// <summary>
        /// Initializes a new instance of the PhotoAreaViewModel class.
        /// </summary>
        /// <param name="ocrData">
        /// A reference to the OcrData instance that stores the 
        /// photo stream and the text obtained after the OCR conversion.
        /// </param>
        /// <param name="ocrConversionStateManager">
        /// A reference to the OcrConversionStateManager instance that stores the 
        /// status of the last OCR conversion.
        /// </param>
        public PhotoAreaViewModel(OcrData ocrData, OcrConversionStateManager ocrConversionStateManager)
            : base(ocrData, ocrConversionStateManager)
        {
            this.OcrData.PropertyChanged += new PropertyChangedEventHandler(this.OcrData_PropertyChanged);

            // If the photo stream is available when this instance is created we'll call OnPhotoStreamChanged
            // to update all properties related to the photo.
            if (this.OcrData.PhotoStream != null)
            {
                this.OnPhotoStreamChanged();
            }
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the OcrViewModelBase class.
        /// </summary>
        /// <param name="ocrData">
        /// A reference to the OcrData instance that stores the 
        /// photo stream and the text obtained after the OCR conversion.
        /// </param>
        /// <param name="ocrConversionStateManager">
        /// A reference to the OcrConversionStateManager instance that stores the 
        /// status of the last OCR conversion.
        /// </param>
        public OcrViewModelBase(OcrData ocrData, OcrConversionStateManager ocrConversionStateManager)
        {
            if (ocrData == null)
            {
                throw new ArgumentNullException("ocrData");
            }

            if (ocrConversionStateManager == null)
            {
                throw new ArgumentNullException("ocrConversionStateManager");
            }

            this.OcrData = ocrData;
            this.OcrConversionStateManager = ocrConversionStateManager;
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the MainPage class.
        /// </summary>
        public OcrMainPage()
        {
            InitializeComponent();

            if (this.VerifyHawaiiAppId())
            {
                this.ocrData = OcrData.Instance;
                this.ocrData.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.OcrData_PropertyChanged);

                this.ocrConversionStateManager = OcrConversionStateManager.Instance;
                this.ocrConversionStateManager.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.ConversionStateManager_PropertyChanged);

                this.mainPivot.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.MainPivot_SelectionChanged);
            }

            Debug.WriteLine("----------------------------\ntesting REST CLIENT\n------------------------------------");
            RestClient rc = new RestClient();
        }
コード例 #5
0
        private TextViewMode textViewMode;    // Wrapped by this.TextViewMode

        /// <summary>
        /// Initializes a new instance of the TextAreaViewModel class.
        /// </summary>
        /// <param name="ocrData">
        /// A reference to the OcrData instance that stores the 
        /// photo stream and the text obtained after the OCR conversion.
        /// </param>
        /// <param name="ocrConversionStateManager">
        /// A reference to the OcrConversionStateManager instance that stores the 
        /// status of the last OCR conversion.
        /// </param>
        public TextAreaViewModel(OcrData ocrData, OcrConversionStateManager ocrConversionStateManager)
            : base(ocrData, ocrConversionStateManager)
        {
        }