Getting Started


Visual Studio 2010 (.Net 4.0)

  • Add a reference to the Stacky.dll located in the 'Stacky' sub folder in the release binaries
  • Add the following to your using statements in your class:

using Stacky;
  • Create an instance of the StackyClient using your Api Key

Synchronus


StackyClient client = new StackyClient("0.9", "<Your API Key Here>", Sites.StackOverflow, new UrlClient(), new JsonProtocol());
  • Call methods on the client

IPagedList<User> users = client.GetUsers();
Console.WriteLine("There are {0} total users", users.TotalItems);
foreach (User user in users)
{
     Console.WriteLine(user.DisplayName);
}

Asynchronus


StackyClientAsync clientAsync = new StackyClientAsync("0.9", "", Sites.StackOverflow, new UrlClientAsync(), new JsonProtocol());
clientAsync.GetUsers(userResults =>
{
    foreach (User user in userResults)
    {
        Console.WriteLine(user.DisplayName);
     }
},
error =>
{
    Console.WriteLine(error.Message);
});


Visual Studio 2008 (.Net 3.5)

  • Add a reference to the Stacky.dll located in the 'Stacky .Net 3.5' sub folder in the release binaries
  • Add the following to your using statements in your class:

using Stacky;
  • Create an instance of the StackyClient using your Api Key

StackyClient client = new StackyClient("0.9", "<Your API Key Here>", Sites.StackOverflow, new UrlClient(), new JsonProtocol());
  • Call methods on the client

IPagedList<User> users = client.GetUsers();
Console.WriteLine("There are {0} total users", users.TotalItems);
foreach (User user in users)
{
     Console.WriteLine(user.DisplayName);
}

Silverlight 4

  • Add a reference to the Stacky.Silverlight.dll located in the 'Stacky.Silverlight' sub folder in the release binaries
  • Add the following to your using statements in your class:

using Stacky;
  • Create an instance of the StackyClient using your Api Key

StackyClient client = new StackyClient("0.9", "<Your API Key Here>", Sites.StackOverflow, new UrlClient(), new JsonProtocol());
  • Call methods on the client

client.GetUsers(users =>
{
    MessageBox.Show(String.Format("There are {0} total users", users.TotalItems));
}, error =>
{
    MessageBox.Show(error.Message);
});

Windows Phone 7

  • Add a reference to the Stacky.WindowsPhone.dll located in the 'Stacky.WindowsPhone' sub folder in the release binaries
  • Add the following to your using statements in your class:

using Stacky;
  • Create an instance of the StackyClient using your Api Key

StackyClient client = new StackyClient("0.9", "<Your API Key Here>", Sites.StackOverflow, new UrlClient(), new JsonProtocol());
  • Call methods on the client

client.GetUsers(users =>
{
    MessageBox.Show(String.Format("There are {0} total users", users.TotalItems));
}, error =>
{
    MessageBox.Show(error.Message);
});

Last edited Jul 4, 2010 at 6:32 AM by lfoust, version 12

Comments

No comments yet.