- prismtutorialsamples_part1.zip
- PrismTutorialSamples_PART1
- ModuleDependencySample
- ModuleLoadingEventsSample
- ModuleLoadingOnDemandSample
- PrismDlls
- Microsoft.Practices.Prism.dll
- Microsoft.Practices.Prism.MefExtensions.dll
- Microsoft.Practices.ServiceLocation.dll
- SimpleNonVisualModuleSample
- SimpleVisualModuleLoadingApp
- ViewInjectionSample
|
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Practices.Prism.MefExtensions;
using System.ComponentModel.Composition.Hosting;
using Microsoft.Practices.Prism.Modularity;
namespace ModuleDependencySample
{
public class TheBootstrapper : MefBootstrapper
{
protected override void InitializeShell()
{
base.InitializeShell();
Application.Current.RootVisual = (UIElement)Shell;
}
protected override DependencyObject CreateShell()
{
return Container.GetExportedValue<Shell>();
}
protected override void ConfigureAggregateCatalog()
{
base.ConfigureAggregateCatalog();
// Prism's AggregateCatalog is a catalog of all MEF composable parts
// within the application.
// We add the parts corresponding to the current assembly to it
AggregateCatalog.Catalogs.Add(new AssemblyCatalog(this.GetType().Assembly));
}
protected override IModuleCatalog CreateModuleCatalog()
{
ModuleCatalog moduleCatalog = new ModuleCatalog();
// this is the code responsible
// for adding Module0 to the application
moduleCatalog.AddModule
(
new ModuleInfo
{
InitializationMode = InitializationMode.OnDemand,
Ref = "Module0.xap",
ModuleName = "Module0Impl",
ModuleType = "Module0.Module0Impl, Module0, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
}
);
// this is the code responsible
// for adding Module1 to the application
moduleCatalog.AddModule
(
new ModuleInfo
{
InitializationMode = InitializationMode.OnDemand,
// set depends on property to include "Module0"
DependsOn = new System.Collections.ObjectModel.Collection<string>{"Module0Impl"},
Ref = "Module1.xap",
ModuleName = "Module1Impl",
ModuleType = "Module1.Module1Impl, Module1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
}
);
return moduleCatalog;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a software architect and a developer with great passion for new engineering solutions and finding and applying design patterns.
I am passionate about learning new ways of building software and sharing my knowledge with others.
I worked with many various languages including C#, Java and C++.
I fell in love with WPF (and later Silverlight) at first sight. After Microsoft killed Silverlight, I was distraught until I found Avalonia - a great multiplatform package for building UI on Windows, Linux, Mac as well as within browsers (using WASM) and for mobile platforms.
I have my Ph.D. from RPI.
here is my linkedin profile