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); }
private WiFi.Authentication CheckWIFIAuthTypeSelected(SpongeQR.Types.WIFIAuthTypes authModeChosen) { if (authModeChosen == SpongeQR.Types.WIFIAuthTypes.WPA || authModeChosen == SpongeQR.Types.WIFIAuthTypes.WPA2) { return(WiFi.Authentication.WPA); } else if (authModeChosen == SpongeQR.Types.WIFIAuthTypes.WEP) { return(WiFi.Authentication.WEP); } else if (authModeChosen == SpongeQR.Types.WIFIAuthTypes.None) { return(WiFi.Authentication.nopass); } else { // Default to WPA as a fallback - as most routers use this return(WiFi.Authentication.WPA); } }