예제 #1
0
 /// <summary>
 /// Requests a QR code scan to the user.
 /// </summary>
 public void ScanCode()
 {
     if (PhotoCamera.IsCameraTypeSupported(CameraType.Primary))
     {
         CodeScannerPopup.Show();
     }
     else
     {
         MessageBoxEx.ShowDialog(PluginResources.NoCameraCaption, PluginResources.NoCameraMessage);
     }
 }
예제 #2
0
        private async void DecodeButton_Click(object sender, RoutedEventArgs e)
        {
            CodeScannerPopup scp = new CodeScannerPopup(SystemTray.IsVisible, Format.ALL_1D);

            //important: hide ApplicationBar and handle BackKeyPress
            ApplicationBar.IsVisible = false;
            this.BackKeyPress       += scp.HandleBackKeyPress;
            //now let's go
            ScanResult r = await scp.ShowAsync("BARCODE SCANNER", "scan");

            if (r != null)
            {
                output.Text = string.Format("{0}\n{1}", r.Text, r.Format.ToString());
            }
            //clean up
            this.BackKeyPress       -= scp.HandleBackKeyPress;
            ApplicationBar.IsVisible = true;
        }