This project is read-only.

Api integration in windows 8 store

Oct 18, 2012 at 5:18 PM

I've managed to integrate the api in a windows 8 store app. It works fine if I provide good QR code images but when I provide a bad image, I get WebException thrown and my issue is that exception is not caught in the catch block.

using windows 8 rtm and VS2012.

here is an example:

                    reader.ReadBytes(myPicArray);
                    var client = new QRCodeClient();
                    client.UseSSL = true; //Use HTTPS
                    client.Format = ApiFormat.Json; //Transfer data in JSON format
                    client.ApplicationName = "MyFirstApplication"; //Displayed in User-Agent string

                    MemoryStream s = new MemoryStream(myPicArray);

                    try
                    {
                        result = await client.DecodeAsync(s, "png"); //Get stream (PNG image) from somewhere
                    }
                    catch (WebException e)
                    {
                        //ignore
                    }

 


Oct 19, 2012 at 1:57 PM
Edited Oct 19, 2012 at 1:57 PM

Thank you for the notification about the issue. The problem originates in Request method inside the QRCodeClientBase class and appears only in WinRT environment.

The issue has been fixed now (build 3.0.6) and the latest version is available here at CodePlex or via NuGet.

Changes: please rename WebException to QRCodeException inside the "catch" statement. Here is a complete example:

var client = new QRCodeClient();
client.UseSSL = true; //Use HTTPS
client.Format = ApiFormat.Json; //Transfer data in JSON format
client.ApplicationName = "MyFirstApplication"; //Displayed in User-Agent string

var wc = new HttpClient();
var response = await wc.GetAsync("http://www.esponce.com/this-sample-is-not-a-qr-code.png");
var myPicArray = await response.Content.ReadAsByteArrayAsync();
MemoryStream s = new MemoryStream(myPicArray);

try
{
  var result = await client.DecodeAsync(s, "png"); //Get stream (PNG image) from somewhere
}
catch (QRCodeException ex)
{
  //Server-side exception related with QR Code decoding
}
catch (Exception ex)
{
  //Any other exception
}
May 9, 2013 at 5:38 PM
I am using the following code

var client = new QRCodeClient();
        client.UseSSL = true; //Use HTTPS
        client.Format = ApiFormat.Json; //Transfer data in JSON format
        client.ApplicationName = "MyFirstApplication"; //Displayed in User-Agent string

        var wc = new HttpClient();
        var response = await wc.GetAsync("http://www.business-spotlight.de/files/business/leadimages/barcode.png");
        var myPicArray = await response.Content.ReadAsByteArrayAsync();
        MemoryStream s = new MemoryStream(myPicArray);

        try
        {
            var result = client.Decode(s, "png"); //Get stream (PNG image) from somewhere
        }
        catch (QRCodeException ex)
        {
            //Server-side exception related with QR Code decoding
        }
        catch (Exception ex)
        {
            //Any other exception
        }
but getting server 500 exception, please help
May 10, 2013 at 4:28 PM
Sorry, but the API accepts only QR Codes - no other 1D or 2D codes. The image located on http://www.business-spotlight.de/files/business/leadimages/barcode.png contains barcode.