Пример #1
0
        private LoaderBase CreateLoaderPrivate()
        {
            LoaderBase loader = this.CreateLoader();

            loader.ContentLoader = this;
            return(loader);
        }
Пример #2
0
 public ContentLoaderBaseAsyncResult(object asyncState, LoaderBase loader, AsyncCallback callback)
 {
     this.AsyncState = asyncState;
     this.Loader = loader;
     this.Lock = new object();
     this.Callback = callback;
     this.AsyncWaitHandle = new AutoResetEvent(false);
 }
Пример #3
0
 public ContentLoaderBaseAsyncResult(object asyncState, LoaderBase loader, AsyncCallback callback)
 {
     this.AsyncState      = asyncState;
     this.Loader          = loader;
     this.Lock            = new object();
     this.Callback        = callback;
     this.AsyncWaitHandle = new AutoResetEvent(false);
 }
Пример #4
0
        /// <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);
            }
        }