internal static Image GetQRImage(string message) { string webURL = EncodeAPI + HttpUtility.UrlEncode(message); try { return(NetUtil.GetImageFromURL(webURL)); } catch { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgQRUrlFailConnection, MsgQRClipboardUrl)) { return(null); } try { Clipboard.SetText(webURL); } catch { WinFormsUtil.Alert(MsgClipboardFailWrite); } } return(null); }
internal static Image getQRImage(byte[] data, string server) { string qrdata = Convert.ToBase64String(data); string message = server + qrdata; string webURL = "http://chart.apis.google.com/chart?chs=365x365&cht=qr&chl=" + HttpUtility.UrlEncode(message); try { return(NetUtil.getImageFromURL(webURL)); } catch { if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Unable to connect to the internet to receive QR code.", "Copy QR URL to Clipboard?")) { return(null); } try { Clipboard.SetText(webURL); } catch { WinFormsUtil.Alert("Failed to set text to Clipboard"); } } return(null); }