public CockpitPanel(IGameLoop loop) { _loop = loop; _loop.RegisterHandler(LoopUpdate); var container = Resolver.Bootstrap(); FuelSystem = container.Resolve <IFuelSystem>(); Alarms = container.Resolve <IAlarms>(); }
public MainWindow() { InitializeComponent(); var c = Resolver.Bootstrap(); var cockpit = c.Resolve <ICockpitPanel>(); DataContext = cockpit; cockpit.Start(); }
public static IUnityContainer CleanDatabase() { var container = Resolver.Bootstrap(); var settings = container.Resolve <ISettings>(); if (File.Exists(settings.DatabasePath)) { File.Delete(settings.DatabasePath); } return(container); }
/// <summary> /// Installs an assembly resolver that provides access to the installation path /// using the <see cref="AssemblyLoaderBootstrap" />. /// </summary> /// <remarks> /// <para> /// Does nothing if the host is local. /// </para> /// <para> /// This hook is recommended for newly created domains. /// </para> /// </remarks> /// <param name="host">The host.</param> /// <param name="runtimePath">The Gallio runtime path.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="host"/> or /// <paramref name="runtimePath" /> is null.</exception> public static void Bootstrap(IHost host, string runtimePath) { if (host == null) { throw new ArgumentNullException("host"); } if (runtimePath == null) { throw new ArgumentNullException("runtimePath"); } if (!host.IsLocal) { Resolver remoteResolver = HostUtils.CreateInstance <Resolver>(host); remoteResolver.Bootstrap(runtimePath); } }
public void Execute <TCommand>(TCommand command) where TCommand : ICommand { var resolver = Resolver.Bootstrap(); if (command == null) { throw new ArgumentNullException("command"); } var handler = resolver.GetInstance <ICommandHandler <TCommand> >(); if (handler == null) { throw new NullReferenceException("handler not found"); } handler.Execute(command); }
public TResult Execute <TQuery, TResult>(TQuery query) where TQuery : IQuery <TResult> { var resolver = Resolver.Bootstrap(); if (query == null) { throw new ArgumentNullException("query"); } var handler = resolver.GetInstance <IQueryHandler <TQuery, TResult> >(); if (handler == null) { throw new NullReferenceException("not found"); } return(handler.Execute(query)); }
public static void Main() { var container = Resolver.Bootstrap(); var settings = container.Resolve <ISettings>(); container.RegisterType <MainWindow>(); container.RegisterType <App>(); container.RegisterType <MainWindowViewModel>(); container.RegisterType <BooksControl>(); container.RegisterType <BooksControlViewModel>(); container.RegisterType <BookDetailsWindow>(new ContainerControlledLifetimeManager()); container.RegisterType <BookDetailsWindowViewModel>(new ContainerControlledLifetimeManager()); container.RegisterType <AuthorDetailsWindow>(); container.RegisterType <AuthorDetailsWindowViewModel>(); container.RegisterType <AuthorsControl>(); container.RegisterType <AuthorsControlViewModel>(); var plugins = container.Resolve <ISupportedFormats>(); var log = container.Resolve <ILog>(); #if EMPTYDATABASE if (Directory.Exists(settings.ApplicationPath)) { try { Directory.Delete(settings.ApplicationPath, true); } catch (Exception) { // Issues deleting log file } } #endif RunApplication(log, plugins, settings, container); }
public Main() { resolver = Resolver.Bootstrap(); }