Example #1
0
        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(Util.getImageFromURL(webURL));
            }
            catch
            {
                if (DialogResult.Yes != Util.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 { Util.Alert("Failed to set text to Clipboard"); }
            }
            return(null);
        }