2012-10-12 44 views
1

我正在研究一個需要與來自Calibrun.Micro的HelloScreens示例具有幾乎相同功能的應用程序。我將代碼轉移到了WPF應用程序,但是當我嘗試運行它時,我在BootStrapper GetInstance方法中不斷收到錯誤將Caliburn.Micro HelloScreens示例從Silverlight轉換爲WPF時出錯

無法找到任何合同WpfApplication.Framework.IShell的實例。

我的配置是

protected override void Configure() 
    { 
     container = new CompositionContainer(
      new AggregateCatalog(AssemblySource.Instance.Select(x => new AssemblyCatalog(x))) 
      ); 

     var batch = new CompositionBatch(); 

     batch.AddExportedValue<IWindowManager>(new WindowManager()); 
     batch.AddExportedValue<IEventAggregator>(new EventAggregator()); 
     batch.AddExportedValue(container); 

     container.Compose(batch); 
    } 

不知道這是什麼東西在國際奧委會還是什麼。任何幫助都會很棒。謝謝!!!

+0

ShellViewModel仍然有'[Export(typeof(IShell))]'? –

回答

1

好吧,我終於明白了。我錯過了這兩行配置

batch.AddExportedValue<Func<IMessageBox>>(() => _container.GetExportedValue<IMessageBox>()); 
batch.AddExportedValue<Func<CustomerViewModel>>(() => _container.GetExportedValue<CustomerViewModel>()); 
0

這絕對是與IoC相關的。如Derek所說,檢查Export屬性。並且請注意,如果您的ShellViewModel在另一個程序集中,則還應該覆蓋Bootstrappers SelectAssemblies()方法。