こんにちは、Caliburn Micro で Windosor Castle を使用してみます。今までMEFしか使っていませんでした。
この Castle Boostraper を見つけました: https://gist.github.com/1127914
この呼び出しをプロジェクトに追加し、App.xaml ファイルを変更しました。
<Application x:Class="Chroma_Configer.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Bootstraper="clr-namespace:Chroma_Configer.Bootstraper">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<Bootstraper:CastleBootstrapper x:Key="bootstrapper" />
<Style x:Key="MainView_FontBaseStyle" TargetType="{x:Type Control}">
<Setter Property="FontFamily" Value="Arial"/>
</Style>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
ShellView (WPF) と ShellViewModel を作成します。
public interface IShellViewModel
{
}
public class ShellViewModel : Conductor<IScreen>.Collection.OneActive,
IShellViewModel
{
}
実行すると、次のエラーが表示されます。
{"No component for supporting the service Chroma_Configer.ViewModels.IShellViewModel was found"}
私はウィンザー城の初心者です。彼が次のような仕事をしていることを知っています。
var container = new WindsorContainer();
container.AddComponent("JsonUtil", typeof(IShellViewModel), typeof(ShellViewModel));
var shell = container.Resolve<IShellViewModel>();
MEF I ユーザー属性[エクスポート]および[インポート] で。この問題について誰か助けてもらえますか?
別の質問は、いくつかのツール クラスがあることです。
public interface ITooll{}
public class Tool:ITool{}
これを ShellViewModel クラスにインポートしたいと思います。
CastleBoostraper でどうすればできますか?