/// <summary> /// Creates a new Alexa request state instance. /// </summary> /// <param name="callback">The callback method.</param> /// <param name="pages">The number of pages to return.</param> /// <param name="ranking">The Alexa ranking list.</param> /// <param name="state">The user state.</param> public AlexaRankingRequestState(AsyncCallback callback, int pages, AlexaRanking ranking, object state) : base(callback, state) { // Set the number of pages. this.Pages = pages; // Set the ranking list. this.ranking = ranking != null ? ranking : new AlexaRanking(); // Clear the ranking list. this.ranking.Clear(); }
/// <summary> /// Begins an asynchronous request for the country-specific Alexa ranking. /// </summary> /// <param name="callback">The callback method.</param> /// <param name="country">The country.</param> /// <param name="pages">The number of pages to return.</param> /// <param name="ranking">The ranking list.</param> /// <param name="userState">The user state.</param> public IAsyncResult BeginGetCountryRanking(AsyncCallback callback, AlexaCountry country, int pages, AlexaRanking ranking = null, object userState = null) { // Create the request state. AlexaRankingRequestState asyncState = new AlexaRankingRequestState(callback, country, pages, ranking, userState); // Call the internal request method. this.BeginGetRankingInternal(asyncState, this.GetUriCountryRanking); // Return the request state. return asyncState; }