Код: Выделить всё
[Module(ModuleName = "SnakeModule")]
class SnakeModule : IGame
{
public void Initialize()
{
Console.WriteLine("test");
}
public void StartGame()
{
throw new NotImplementedException();
}
}
Код: Выделить всё
class BootStrap : MefBootstrapper
{
protected override DependencyObject CreateShell()
{
return ServiceLocator.Current.GetInstance();
}
protected override void InitializeShell()
{
Application.Current.MainWindow = (Window)this.Shell;
Application.Current.MainWindow.Show();
}
protected override void ConfigureAggregateCatalog()
{
this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(BootStrap).Assembly));
}
protected override IModuleCatalog CreateModuleCatalog()
{
DirectoryModuleCatalog catalog = new DirectoryModuleCatalog() { ModulePath = @"..\..\..\GameTestLib\bin\Debug" };
return catalog;
}
protected override void ConfigureContainer()
{
base.ConfigureContainer();
}
}
Подробнее здесь: https://stackoverflow.com/questions/143 ... og-to-work