private void generateQR()
        {
            barcodegcode = "";
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            QRCodeData      qrCodeData;

            if (tCQRPayload.SelectedIndex == 0)
            {
                Logger.Trace("TabControl 0");
                qrCodeData = qrGenerator.CreateQrCode(tBQRText.Text, QRCodeGenerator.ECCLevel.Q);
            }
            else if (tCQRPayload.SelectedIndex == 1)
            {
                Logger.Trace("TabControl 1");
                Url    generator = new Url(tBQRURL.Text);
                string payload   = generator.ToString();
                qrCodeData = qrGenerator.CreateQrCode(payload, QRCodeGenerator.ECCLevel.Q);
            }
            else //if (tCQRPayload.SelectedIndex == 2)
            {
                Logger.Trace("TabControl 2");
                WiFi.Authentication auth = WiFi.Authentication.nopass;
                if (rBWLAN1.Checked)
                {
                    auth = WiFi.Authentication.WPA;
                }
                if (rBWLAN2.Checked)
                {
                    auth = WiFi.Authentication.WEP;
                }
                WiFi   generator = new WiFi(tBWLAN1.Text, tBWLAN2.Text, auth, cBWLAN1.Checked);
                string payload   = generator.ToString();
                qrCodeData = qrGenerator.CreateQrCode(payload, QRCodeGenerator.ECCLevel.Q);
            }


            QRCode qrCode = new QRCode(qrCodeData);

            if (cBInsertLogo.Checked)
            {
                qrCodeImage = qrCode.GetGraphic((int)Properties.Settings.Default.importBarcode2DLines, System.Drawing.Color.Black, System.Drawing.Color.White, (System.Drawing.Bitmap)pictureBox3.Image);
            }
            else
            {
                qrCodeImage = qrCode.GetGraphic((int)Properties.Settings.Default.importBarcode2DLines); // pixel per module
            }
            pictureBox2.Image             = qrCodeImage;
            btnClipboardBarcode2D.Visible = true;
        }
Пример #2
0
        public void GenerateWIFIQR(System.Windows.Controls.Image imageViewer)
        {
            string ssid     = mainWindow.wifiData.WifiSSID;
            string password = mainWindow.wifiData.WifiPassword;

            SpongeQR.Types.WIFIAuthTypes authMode = mainWindow.wifiData.WifiAuthType;

            WiFi.Authentication auth = CheckWIFIAuthTypeSelected(authMode);

            WiFi generator = new WiFi(ssid, password, auth);

            string payload = generator.ToString();

            Console.WriteLine(payload);

            QRCode qrCode = GenerateQRData(payload);

            ConvertBitmapToSourceAndDisplay(qrCodeImage, qrCode, Bitmapsource, imageViewer);
        }