/// <summary> /// Completes the asynchronous content loading operation. /// </summary> /// <param name = "asyncResult">An object that identifies the asynchronous operation.</param> /// <returns>An object that represents the result of the asynchronous content loading operation.</returns> public LoadResult EndLoad(IAsyncResult asyncResult) { ContentLoaderBaseAsyncResult result = (ContentLoaderBaseAsyncResult)asyncResult; if (result.Error != null) { throw result.Error; } return(result.Page != null ? new LoadResult(result.Page) : new LoadResult(result.RedirectUri)); }
/// <summary> /// Begins asynchronous loading of the content for the specified target URI. /// </summary> /// <param name = "targetUri">The URI to load content for.</param> /// <param name = "currentUri">The URI that is currently loaded.</param> /// <param name = "userCallback">The method to call when the content finishes loading.</param> /// <param name = "asyncState">An object for storing custom state information.</param> /// <returns>An object that stores information about the asynchronous operation.</returns> public IAsyncResult BeginLoad(Uri targetUri, Uri currentUri, AsyncCallback userCallback, object asyncState) { LoaderBase loader = this.CreateLoaderPrivate(); ContentLoaderBaseAsyncResult result = new ContentLoaderBaseAsyncResult(asyncState, loader, userCallback); result.BeginLoadCompleted = false; loader.Result = result; lock (result.Lock) { loader.Load(targetUri, currentUri); result.BeginLoadCompleted = true; return result; } }
/// <summary> /// Begins asynchronous loading of the content for the specified target URI. /// </summary> /// <param name = "targetUri">The URI to load content for.</param> /// <param name = "currentUri">The URI that is currently loaded.</param> /// <param name = "userCallback">The method to call when the content finishes loading.</param> /// <param name = "asyncState">An object for storing custom state information.</param> /// <returns>An object that stores information about the asynchronous operation.</returns> public IAsyncResult BeginLoad(Uri targetUri, Uri currentUri, AsyncCallback userCallback, object asyncState) { LoaderBase loader = this.CreateLoaderPrivate(); ContentLoaderBaseAsyncResult result = new ContentLoaderBaseAsyncResult(asyncState, loader, userCallback); result.BeginLoadCompleted = false; loader.Result = result; lock (result.Lock) { loader.Load(targetUri, currentUri); result.BeginLoadCompleted = true; return(result); } }