2010-12-19 8 views
0

プロジェクトをcaliburn.microからnormal caliburnに変換する必要があります。私はブートストラップクラスに問題があります。プロジェクトをCaliburn.Microから "normal"に変換する際の問題点Caliburn

私は次のようになりcaliburn.micro:

public class MefBootStrapper : BootStraper<IShellViewModel> 
{ 
#region Fields 
private CompositionContainer _container; 
#endregion 

#region Overrides 
protected override void Configure() 
{ // configure container 
#if SILVERLIGHT 
    _container = CompositionHost.Initialize(
    new AggregateCatalog(AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType<ComposablePartCatalog>())); 
#else 

    var catalog = 
     new AggregateCatalog(
      AssemblySource.Instance.Select(x => new AssemblyCatalog(x)).OfType<ComposablePartCatalog>()); 

    //add external DLL 
    catalog.Catalogs.Add(
     new AssemblyCatalog(string.Format(
      CultureInfo.InvariantCulture, "{0}{1}", System.IO.Directory.GetCurrentDirectory(), @"\Pokec_Toolkit.dll"))); 

    _container = new CompositionContainer(catalog); 
#endif 

    var batch = new CompositionBatch(); 

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

    _container.Compose(batch); 
} 

protected override object GetInstance(Type serviceType, string key) 
{ 
    string contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(serviceType) : key; 
    var exports = _container.GetExportedValues<object>(contract); 

    if (exports.Count() > 0) 
    return exports.First(); 

    throw new Exception(string.Format("Could not locate any instances of contract {0}.", contract)); 
} 

protected override IEnumerable<object> GetAllInstances(Type serviceType) 
{ 
    return _container.GetExportedValues<object>(AttributedModelServices.GetContractName(serviceType)); 
} 

protected override void BuildUp(object instance) 
{ 
    _container.SatisfyImportsOnce(instance); 
} 

protected override IEnumerable<System.Reflection.Assembly> SelectAssemblies() 
{ 
    return base.SelectAssemblies(); 
} 
#endregion 
} 

私は、注射にMEFを使用しています。

問題はCaliburnに存在しませんBooStraperクラス。これをどうすれば解決できますか?

外部アセンブリからロードタイプが必要です。

ありがとうございます

答えて

0

最新のソースコードを使用していますか?ブートストラップは最近Caliburnに移植されました。

関連する問題