/// <summary>
        /// Reset the Scenario state
        /// </summary>
        void ResetTheScenarioState()
        {
            if (_claimedReader != null)
            {
                // Detach the datareceived event handler and releasedevicerequested event handler
                _claimedReader.BankCardDataReceived   -= OnBankCardDataReceived;
                _claimedReader.ReleaseDeviceRequested -= OnReleaseDeviceRequested;

                // release the Claimed Magnetic Stripe Reader and set to null
                _claimedReader.Dispose();
                _claimedReader = null;
            }

            if (_reader != null)
            {
                // release the Magnetic Stripe Reader and set to null
                _reader = null;
            }

            // Reset the strings in the UI
            rootPage.NotifyUser("Click the Start Receiving Data Button.", NotifyType.StatusMessage);

            ScenarioOutputAccountNumber.Text  = "No data";
            ScenarioOutputExpirationDate.Text = "No data";
            ScenarioOutputFirstName.Text      = "No data";
            ScenarioOutputMiddleInitial.Text  = "No data";
            ScenarioOutputServiceCode.Text    = "No data";
            ScenarioOutputSuffix.Text         = "No data";
            ScenarioOutputSurname.Text        = "No data";
            ScenarioOutputTitle.Text          = "No data";

            // reset the button state
            ScenarioEndReadButton.IsEnabled   = false;
            ScenarioStartReadButton.IsEnabled = true;
        }
Пример #2
0
        /// <summary>
        /// Claim the magnetic stripe reader
        /// </summary>
        /// <returns>true if claim is successful. Otherwise returns false</returns>
        private async Task <bool> ClaimReader()
        {
            if (_claimedReader == null)
            {
                // claim the magnetic stripe reader
                _claimedReader = await _reader.ClaimReaderAsync();

                if (_claimedReader == null)
                {
                    rootPage.NotifyUser("Claim Magnetic Stripe Reader failed.", NotifyType.ErrorMessage);
                    return(false);
                }
            }
            return(true);
        }
        /// <summary>
        /// Claim the magnetic stripe reader
        /// </summary>
        /// <returns>true if claim is successful. Otherwise returns false</returns>
        private async Task<bool> ClaimReader()
        {
            if (_claimedReader == null)
            {
                // claim the magnetic stripe reader
                _claimedReader = await _reader.ClaimReaderAsync();

                if (_claimedReader == null)
                {
                    rootPage.NotifyUser("Claim Magnetic Stripe Reader failed.", NotifyType.ErrorMessage);
                    return false;
                }
            }
            return true;
        }
Пример #4
0
        /// <summary>
        /// Reset the Scenario state
        /// </summary>
        void ResetTheScenarioState()
        {
            if (_claimedReader != null)
            {
                // Detach the datareceived event handler and releasedevicerequested event handler
                _claimedReader.AamvaCardDataReceived  -= OnAamvaCardDataReceived;
                _claimedReader.ReleaseDeviceRequested -= OnReleaseDeviceRequested;

                // release the Claimed Magnetic Stripe Reader and set to null
                _claimedReader.Dispose();
                _claimedReader = null;
            }

            if (_reader != null)
            {
                // release the Magnetic Stripe Reader and set to null
                _reader.Dispose();
                _reader = null;
            }

            // Reset the strings in the UI
            rootPage.NotifyUser("Click the Start Receiving Data Button.", NotifyType.StatusMessage);

            ScenarioOutputAddress.Text        = "No data";
            ScenarioOutputBirthDate.Text      = "No data";
            ScenarioOutputCity.Text           = "No data";
            ScenarioOutputClass.Text          = "No data";
            ScenarioOutputEndorsements.Text   = "No data";
            ScenarioOutputExpirationDate.Text = "No data";
            ScenarioOutputEyeColor.Text       = "No data";
            ScenarioOutputFirstName.Text      = "No data";
            ScenarioOutputGender.Text         = "No data";
            ScenarioOutputHairColor.Text      = "No data";
            ScenarioOutputHeight.Text         = "No data";
            ScenarioOutputLicenseNumber.Text  = "No data";
            ScenarioOutputPostalCode.Text     = "No data";
            ScenarioOutputRestrictions.Text   = "No data";
            ScenarioOutputState.Text          = "No data";
            ScenarioOutputSuffix.Text         = "No data";
            ScenarioOutputSurname.Text        = "No data";
            ScenarioOutputWeight.Text         = "No data";

            // reset the button state
            ScenarioEndReadButton.IsEnabled   = false;
            ScenarioStartReadButton.IsEnabled = true;
        }
        //<SnippetClaimMagStripeReader>
        // Claims the magnetic stripe reader for exclusive use.

        private async Task <bool> ClaimReader()
        {
            if (_claimedReader == null)
            {
                _claimedReader = await _reader.ClaimReaderAsync();

                if (_claimedReader != null)
                {
                    // UpdateReaderStatusTextBlock("Magnetic stripe reader claimed successfully.");
                }
                else
                {
                    // UpdateReaderStatusTextBlock("Failed to claim a magnetic stripe reader.");
                    return(false);
                }
            }
            return(true);
        }
Пример #6
0
        /// <summary>
        /// Claim the magnetic stripe reader
        /// </summary>
        /// <returns>true if claim is successful. Otherwise returns false</returns>
        private async Task<bool> ClaimReader()
        {
            if (_claimedReader == null)
            {
                // claim the magnetic stripe reader
                _claimedReader = await _reader.ClaimReaderAsync();

                // enable the claimed magnetic stripe reader
                if (_claimedReader != null)
                {
                    UpdateReaderStatusTextBlock("Claim Magnetic Stripe Reader succeeded.");
                }
                else
                {
                    UpdateReaderStatusTextBlock("Claim Magnetic Stripe Reader failed.");
                    return false;
                }
            }
            return true;
        }
Пример #7
0
        /// <summary>
        /// Claim the magnetic stripe reader
        /// </summary>
        /// <returns>true if claim is successful. Otherwise returns false</returns>
        private async Task <bool> ClaimReader()
        {
            if (_claimedReader == null)
            {
                // claim the magnetic stripe reader
                _claimedReader = await _reader.ClaimReaderAsync();

                // enable the claimed magnetic stripe reader
                if (_claimedReader != null)
                {
                    UpdateReaderStatusTextBlock("Claim Magnetic Stripe Reader succeeded.");
                }
                else
                {
                    UpdateReaderStatusTextBlock("Claim Magnetic Stripe Reader failed.");
                    return(false);
                }
            }
            return(true);
        }
Пример #8
0
 /// <summary>
 /// Event handler for the Release Device Requested event fired when magnetic stripe reader receives Claim request from another application
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"> Contains the ClaimedMagneticStripeReader that is sending this request</param>
 void OnReleaseDeviceRequested(object sender, ClaimedMagneticStripeReader args)
 {
     // let us retain the device always. If it is not retained, this exclusive claim will be lost.
     args.RetainDevice();
 }
        /// <summary>
        /// Reset the Scenario state
        /// </summary>
        void ResetTheScenarioState()
        {
            if (_claimedReader != null)
            {
                // Detach the datareceived event handler and releasedevicerequested event handler
                _claimedReader.AamvaCardDataReceived -= OnAamvaCardDataReceived;
                _claimedReader.ReleaseDeviceRequested -= OnReleaseDeviceRequested;

                // release the Claimed Magnetic Stripe Reader and set to null
                _claimedReader.Dispose();
                _claimedReader = null;
            }

            if (_reader != null)
            {
                // release the Magnetic Stripe Reader and set to null
                _reader = null;
            }

            // Reset the strings in the UI
            rootPage.NotifyUser("Click the Start Receiving Data Button.", NotifyType.StatusMessage);

            ScenarioOutputAddress.Text = "No data";
            ScenarioOutputBirthDate.Text = "No data";
            ScenarioOutputCity.Text = "No data";
            ScenarioOutputClass.Text = "No data";
            ScenarioOutputEndorsements.Text = "No data";
            ScenarioOutputExpirationDate.Text = "No data";
            ScenarioOutputEyeColor.Text = "No data";
            ScenarioOutputFirstName.Text = "No data";
            ScenarioOutputGender.Text = "No data";
            ScenarioOutputHairColor.Text = "No data";
            ScenarioOutputHeight.Text = "No data";
            ScenarioOutputLicenseNumber.Text = "No data";
            ScenarioOutputPostalCode.Text = "No data";
            ScenarioOutputRestrictions.Text = "No data";
            ScenarioOutputState.Text = "No data";
            ScenarioOutputSuffix.Text = "No data";
            ScenarioOutputSurname.Text = "No data";
            ScenarioOutputWeight.Text = "No data";

            // reset the button state
            ScenarioEndReadButton.IsEnabled = false;
            ScenarioStartReadButton.IsEnabled = true;
        }
 /// <summary>
 /// Event handler for the Release Device Requested event fired when magnetic stripe reader receives Claim request from another application
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"> Contains the ClaimedMagneticStripeReader that is sending this request</param>
 void OnReleaseDeviceRequested(object sender, ClaimedMagneticStripeReader args)
 {
     // let us retain the device always. If it is not retained, this exclusive claim will be lost.
     args.RetainDevice();
 }
Пример #11
0
        /// <summary>
        /// Reset the Scenario state
        /// </summary>
        void ResetTheScenarioState()
        {
            if (_claimedReader != null)
            {
                // Detach the datareceived event handler and releasedevicerequested event handler
                _claimedReader.BankCardDataReceived -= OnBankCardDataReceived;
                _claimedReader.ReleaseDeviceRequested -= OnReleaseDeviceRequested;
        
                // release the Claimed Magnetic Stripe Reader and set to null
                _claimedReader.Dispose();		
                _claimedReader = null;
            }

            if (_reader != null)
            {
                // release the Magnetic Stripe Reader and set to null
                _reader = null;
            }

            // Reset the strings in the UI
            ReaderStatusText.Text = "Click the Start Receiving Data Button.";
            ScenarioOutputAccountNumber.Text = "No data";
            ScenarioOutputExpirationDate.Text = "No data";
            ScenarioOutputFirstName.Text = "No data";
            ScenarioOutputMiddleInitial.Text = "No data";
            ScenarioOutputServiceCode.Text = "No data";
            ScenarioOutputSuffix.Text = "No data";
            ScenarioOutputSurname.Text = "No data";
            ScenarioOutputTitle.Text = "No data";

            // reset the button state
            ScenarioEndReadButton.IsEnabled = false;
            ScenarioStartReadButton.IsEnabled = true;
        }
 public ClaimedMagneticStripeReaderEvents(ClaimedMagneticStripeReader This)
 {
     this.This = This;
 }