当前位置: 首页>>代码示例>>C#>>正文


C# AssemblyLoader.Load方法代码示例

本文整理汇总了C#中AssemblyLoader.Load方法的典型用法代码示例。如果您正苦于以下问题:C# AssemblyLoader.Load方法的具体用法?C# AssemblyLoader.Load怎么用?C# AssemblyLoader.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AssemblyLoader的用法示例。


在下文中一共展示了AssemblyLoader.Load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

 public void Setup()
 {
     var assemblyLoader = new AssemblyLoader("DomainTestClasses.dll");
     var assembly = assemblyLoader.Load();
     _methodFinder = new AssemblySearcher(assembly);
 }
开发者ID:neelendu,项目名称:DrivenMetrics,代码行数:6,代码来源:NumberOfLinesCalculatorTests.cs

示例2: DownloadXapFile

        /// <summary>Downloads the specified XAP file.</summary>
        /// <param name="xapFileName">The name of the XAP file to download.</param>
        /// <param name="callback">Action to invoke when complete (passes back the entry-point assembly).</param>
        public static void DownloadXapFile(string xapFileName, Action<Assembly> callback)
        {
            // Setup initial conditions.
            if (DownloadCatalog == null) throw new InitializationException("The 'DownloadCatalog' has not been set. Create this an initialize it with the CompositionHost during startup.");

            // Download the XAP file.
            var loader = new AssemblyLoader(xapFileName);
            loader.Load(() =>
                            {
                                // Check for errors.
                                if (loader.Error != null)
                                {
                                    Output.Write("Failed to load XAP file: " + xapFileName);
                                    Output.Write(loader.Error);
                                    if (callback != null) callback(loader.RootAssembly);
                                    return;
                                }

                                // Register the assemblies with MEF.
                                var currentAssemblies = Deployment.Current.GetAssemblies();
                                foreach (var assembly in loader.Assemblies)
                                {
                                    try
                                    {
                                        if (currentAssemblies.Contains(assembly)) continue; // Ensure assemblies are not added more than once.
                                        DownloadCatalog.Catalogs.Add(new AssemblyCatalog(assembly));
                                    }
                                    catch (Exception error)
                                    {
                                        Output.WriteTitle(Colors.Red, "Load Failure");
                                        Output.Write(
                                            Colors.Red, 
                                            string.Format("Failed to load assembly while downloading the XAP file: '{0}'", 
                                                    xapFileName));
                                        Output.WriteException(error);
                                        break;
                                    }
                                }

                                // Finish up.
                                if (callback != null) callback(loader.RootAssembly);


                                //TEMP 
                                // Re-download with the MEF package-downloader to ensure it gets registered correctly with MEF.
                                // NB: This should get the XAP file from cache.
                                //var mefDownloader = new DeploymentCatalog(loader.XapFileName);
                                //mefDownloader.DownloadCompleted += delegate
                                //                                       {
                                //                                           // Finish up.
                                //                                           if (callback != null) callback(loader.RootAssembly);
                                //                                       };
                                //mefDownloader.DownloadAsync();
                            });
        }
开发者ID:philcockfield,项目名称:Open.TestHarness.SL,代码行数:58,代码来源:Network.cs


注:本文中的AssemblyLoader.Load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。