Update:
You have indeed uncovered a bug introduced into the WP7ApiContext.Initialize(async)
code.
I will addresshave fixed this ASAPand will post new binaries within the hour.
Here is a simple example that will work with the Soapi.CS-1.0.1.3-binaries.zip when they are uploaded.
using System;
using System.Linq;
using System.Threading;
using System.Windows;
using Microsoft.Phone.Controls;
using Soapi;
using Soapi.Parameters;
namespace MarksIssue
{
public partial class MainPage : PhoneApplicationPage
{
#region Fields
private ApiContext _context;
#endregion
#region Constructors
// Constructor
public MainPage()
{
InitializeComponent();
}
#endregion
#region Private Methods
private void _context_Initialized(object sender, EventArgs e)
{
// get off the ui thread
ThreadPool.QueueUserWorkItem(delegate
{
var questions = _context
.Official
.StackOverflow
.Questions
.PageSize(20)
.Sort(QuestionSort.Creation)
.Order(SortOrder.Desc)
.ToList();
// marshal results back onto the UI thread
Dispatcher.BeginInvoke(() => { listBox1.ItemsSource = questions.Select(q => new { q.Title }); });
});
}
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
_context = new ApiContext("qgAq_KfDu0KYzlNG-qaTuw")
.Options
.LazyLoadingEnabled(true)
.Context;
_context.Initialized += _context_Initialized;
_context.Initialize();
}
#endregion
}
}