How To Use AsyncInit on Silverlight |
This topic details the steps necessary for creating asynchronously initialized types with AsyncInit on Silverlight 4 and 5.
Silverlight 4 and 5 won't allow anyone other than the declaring type access to private members, requiring a slightly different procedure.
Declare an internal (rather than private) constructor:
internal UniversalAnswerService() : base(null) { }
Expose it to Ditto.AsyncInit by adding the following attribute to Properties\AssemblyInfo.cs:
[assembly: InternalsVisibleTo("Ditto.AsyncInit")]
var service = await UniversalAnswerService.CreateAsync(progress, cancellationToken); var answer = service.Answer;