是否可以在不重新编译的情况下向 Prism 应用程序添加新控件?
Is it possible to add new control to Prism application without recompilation?
我在 Prism
应用程序中只有一个模块。让此模块的名称为 ModuleA
,应用程序名称为 "CoolAppl"
。这个应用程序很酷,它在生产中运行得很好。曾经有人想向此应用程序 "CoolAppl"
.
添加新按钮,例如 "Delete Person"
我的问题是我或来自另一个城市的另一个人是否可以添加新按钮 "Delete Person"
到应用程序 "CoolAppl"
的 ModuleA
而无需重新编译任何模块,只需添加 dll有必要的按钮 Delete Person
?
如果可能的话,请告诉我方向 dig/search:).
我正在使用这样的导航机制:
Uri wholeView = new Uri("ModuleA", UriKind.Relative);
regionManager.RequestNavigate(RegionNames.TheBottomRegion, wholeView);
var currentView = regionManager.Regions[RegionNames.TheWholeRegion].Views.ElementAt(0);
regionManager.Regions[RegionNames.TheWholeRegion].Remove(currentView);
和 class 来识别模块看起来像这样:
public class ModuleAModule : ModuleBase, IModule
{
private readonly IRegionManager _regionManager;
private readonly IUnityContainer _container;
public ModuleAModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager)
{
_regionManager = regionManager;
_container = container;
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.TheWholeRegion, typeof(LoginControl));
}
protected override void RegisterTypes()
{
Container.RegisterType<IViewModel, MyViewModel>();
Container.RegisterTypeForNavigation<MySuperControl>();
}
}
如果不重编译就意味着"not recompile everything",那么你只需要重编译ModuleA即可。如果它表示 "recompile nothing at all",那你就不走运了。
如果新按钮不需要在 ModuleA 中,则可以创建一个新的 ModuleB,而无需重新编译 CoolAppl 或 ModuleA(但需要编译 ModuleB)。
不过,您可能已经放置了一个插件系统,从插件加载按钮,然后您可以为新按钮添加另一个插件。
我在 Prism
应用程序中只有一个模块。让此模块的名称为 ModuleA
,应用程序名称为 "CoolAppl"
。这个应用程序很酷,它在生产中运行得很好。曾经有人想向此应用程序 "CoolAppl"
.
"Delete Person"
我的问题是我或来自另一个城市的另一个人是否可以添加新按钮 "Delete Person"
到应用程序 "CoolAppl"
的 ModuleA
而无需重新编译任何模块,只需添加 dll有必要的按钮 Delete Person
?
如果可能的话,请告诉我方向 dig/search:).
我正在使用这样的导航机制:
Uri wholeView = new Uri("ModuleA", UriKind.Relative);
regionManager.RequestNavigate(RegionNames.TheBottomRegion, wholeView);
var currentView = regionManager.Regions[RegionNames.TheWholeRegion].Views.ElementAt(0);
regionManager.Regions[RegionNames.TheWholeRegion].Remove(currentView);
和 class 来识别模块看起来像这样:
public class ModuleAModule : ModuleBase, IModule
{
private readonly IRegionManager _regionManager;
private readonly IUnityContainer _container;
public ModuleAModule(IUnityContainer container, IRegionManager regionManager)
: base(container, regionManager)
{
_regionManager = regionManager;
_container = container;
}
protected override void InitializeModule()
{
RegionManager.RegisterViewWithRegion(RegionNames.TheWholeRegion, typeof(LoginControl));
}
protected override void RegisterTypes()
{
Container.RegisterType<IViewModel, MyViewModel>();
Container.RegisterTypeForNavigation<MySuperControl>();
}
}
如果不重编译就意味着"not recompile everything",那么你只需要重编译ModuleA即可。如果它表示 "recompile nothing at all",那你就不走运了。 如果新按钮不需要在 ModuleA 中,则可以创建一个新的 ModuleB,而无需重新编译 CoolAppl 或 ModuleA(但需要编译 ModuleB)。
不过,您可能已经放置了一个插件系统,从插件加载按钮,然后您可以为新按钮添加另一个插件。