Zoom.it

API Helper Libraries - Silverlight

For Silverlight usage, we've made a Silverlight class library that abstracts away the low-level logic of making HTTP requests to the API and instead exposes higher-level classes and methods.

You can download this library along with our other helper libraries on our libraries page. To use it, include the Silverlight ZoomitWebApi.dll assembly and add a reference to the Microsoft.Zoomit namespace. Note that we've included a separate build of this Silverlight library for use on Windows Phone 7, but the usage remains the same.

Class outline

public class DziInfo
{
    public  Uri     Uri                 { get; }
    public  int     Width               { get; }
    public  int     Height              { get; }
    public  int     TileSize            { get; }
    public  int     TileOverlap         { get; }
    public  string  TileFormat          { get; }
}
public class ContentInfo
{
    public  string   Id                 { get; }
    public  Uri      Uri                { get; }
    public  bool     Ready              { get; }
    public  bool     Failed             { get; }
    public  double   Progress           { get; }
    public  Uri      ViewUri            { get; }
    public  string   EmbedHtml          { get; }
    public  string   Title              { get; }
    public  string   AttributionText    { get; }
    public  Uri      AttributionUri     { get; }
    public  DziInfo  Dzi                { get; }
}
public static class Zoomit
{
    public static IAsyncResult BeginGetContentInfo(
        string id, AsyncCallback callback, object state);
    
    public static IAsyncResult BeginGetContentInfo(
        Uri uri, AsyncCallback callback, object state);
    
    public static ContentInfo EndGetContentInfo(
        IAsyncResult asyncResult);

    public static bool TryEndGetContentInfo(
        IAsyncResult asyncResult, out ContentInfo content);
}

Usage example

A simple usage example is below, but we recommend reading the Silverlight quickstart for more helpful guidance.

Uri uri = new Uri("http://example.com/");

Zoomit.BeginGetContentInfo(uri, asyncResult =>
{
    try
    {
        ContentInfo content =
            Zoomit.EndGetContentInfo(asyncResult);
    
        // do something with content
    }
    catch (Exception e)
    {
        // do something with exception
    }
}, uri);


Terms of Use Privacy Statement © Microsoft Corp.