概述
这节主要通过发射+Caliburn.Micro自带的ioc容器实现加载并显示其它项目中的界面.实现效果如下:
具体实现
-. ①首先在引导程序页面通过发射加载类库,并将视图注入ioc容器,这里为了实现解耦合注入了ICommonBasePage接口类型:
private void ExternalLoad()
{
//container = new SimpleContainer();
//container.Instance(container);
var asmPath = Assembly.GetAssembly(typeof(HelloBootstrapper)).Location;
var path = Directory.GetParent(asmPath).FullName;
string filePath = Path.Combine(path, "PluginTest.dll");
//var assembly = Assembly.GetAssembly(typeof(PageBase));
//container.AllTypesOf<ShellViewModel>(assembly);
var assembly = Assembly.LoadFile(filePath);