Example #1
0
        private async void AppBarButton_Click(object sender, RoutedEventArgs e)
        {
            var btn = sender as AppBarButton;

            switch (btn.Name)
            {
            case "btnEncode":
                imgQR.Source = QRCodec.EncodeQR(edQR.Text, CURRENT_FGCOLOR, CURRENT_BGCOLOR, CURRENT_ECL);
                break;

            case "btnDecode":
                edQR.Text = await QRCodec.Decode(await imgQR.ToWriteableBitmap());

                break;

            case "btnCopy":
                Utils.SetClipboard(imgQR, CURRENT_SIZE);
                break;

            case "btnPaste":
                edQR.Text = await Utils.GetClipboard(edQR.Text, imgQR);

                break;

            case "btnCapture":
                //var sc = new ScreenCapture(imgQR);
                //await sc.StartCaptureAsync();
                break;

            case "btnSave":
                if (CURRENT_SIZE == 0)
                {
                    int size = (int)((imgQR.Parent as Viewbox).ActualWidth);
                    await Utils.ShowSaveDialog(imgQR, size, "QR");
                }
                else
                {
                    await Utils.ShowSaveDialog(imgQR, CURRENT_SIZE, "QR");
                }
                break;

            case "btnShare":
                await Utils.Share(await imgQR.ToWriteableBitmap(), "QR");

                break;

            default:
                break;
            }
        }
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.Parameter != null)
     {
         var data = e.Parameter;
         if (data is string)
         {
             edQR.Text    = data.ToString();
             imgQR.Source = edQR.Text.EncodeQR(CURRENT_FGCOLOR, CURRENT_BGCOLOR, CURRENT_ECL);
         }
         else if (data is WriteableBitmap)
         {
             imgQR.Source = data as WriteableBitmap;
             edQR.Text    = await QRCodec.Decode(imgQR.Source as WriteableBitmap);
         }
     }
 }
Example #3
0
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.Parameter != null)
     {
         var data = e.Parameter;
         if (data is string)
         {
             imgBarcode.Stretch = Stretch.Uniform;
             edBarcode.Text     = data.ToString();
             imgBarcode.Source  = await edBarcode.Text.EncodeBarcode(CURRENT_FORMAT, CURRENT_FGCOLOR, CURRENT_BGCOLOR, CURRENT_TEXT_FONTSIZE, CURRENT_CHECKSUM);
         }
         else if (data is WriteableBitmap)
         {
             imgBarcode.Source = data as WriteableBitmap;
             edBarcode.Text    = await QRCodec.Decode(imgBarcode.Source as WriteableBitmap);
         }
     }
 }