private static void BeginLoadCore(AsyncCallback userCallback, AssemblyNavigationContentLoaderAsyncResult result)
 {
     if (_downloader == null) {
         _downloader = new AssemblyDownloader();
     }
     var handlers = new EventHandler<DownloadCommpletedEventArgs>[1];
     handlers[0] = (sender, e) => {
         _downloader.DownloadCommpleted -= handlers[0];
         result.Assembly = e.Result;
         userCallback(result);
     };
     _downloader.DownloadCommpleted += handlers[0];
     _downloader.DownloadAsync(result.AssemblyName);
 }
Esempio n. 2
0
        private static void BeginLoadCore(AsyncCallback userCallback, AssemblyNavigationContentLoaderAsyncResult result)
        {
            if (_downloader == null)
            {
                _downloader = new AssemblyDownloader();
            }
            var handlers = new EventHandler <DownloadCommpletedEventArgs> [1];

            handlers[0] = (sender, e) => {
                _downloader.DownloadCommpleted -= handlers[0];
                result.Assembly = e.Result;
                userCallback(result);
            };
            _downloader.DownloadCommpleted += handlers[0];
            _downloader.DownloadAsync(result.AssemblyName);
        }
Esempio n. 3
0
        public IAsyncResult BeginLoad(Uri targetUri, Uri currentUri, AsyncCallback userCallback, object asyncState)
        {
            var typeFullName = targetUri.ToString();

            if (string.IsNullOrEmpty(typeFullName))
            {
                return(null);
            }
            var arr          = typeFullName.Split(',');
            var typeName     = arr[0];
            var assemblyName = AssemblyDownloader.EnsureAssemblyNameEndsWdithDll(arr[1]);
            var asyncResult  = new AssemblyNavigationContentLoaderAsyncResult {
                AsyncState   = asyncState,
                TypeName     = typeName,
                AssemblyName = assemblyName
            };

            BeginLoadCore(userCallback, asyncResult);
            return(asyncResult);
        }