|
Hi
I'm using version 1.1.0.49753 of Caliburn
and MEF shipped with the .Net 4 framework
public App()
{
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
this.InitializeComponent();
CaliburnFramework
.ConfigureCore()
.WithAssemblies(Assembly.GetExecutingAssembly())
.Start();
}
protected override IServiceLocator CreateContainer()
{
var catalog = new AggregateCatalog(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
_container = new CompositionContainer(catalog);
return new MEFAdapter(_container);
}
protected override object CreateRootModel()
{
var binder = (DefaultBinder)Container.GetInstance<IBinder>();
binder.EnableMessageConventions();
binder.EnableBindingConventions();
return this._container.GetExportedValue<IShellViewModel>();
}
I was able to get around it via a Factory pattern and no longer Discovering object through the ServiceLocator like in the intial post.
Though Interest to no why it stopped working.
Also one question would it be possible to Import the caliburn Default Window Manager?
[Export(typeof(ISomeObject))]
public class SomeObject : ISomeObject
{
[Import(typeof(IWindowManager))]
public IWindowManager WindowManager { get; set; }
}
Cheers,
the Haggis.
|