private void SetupMainWindowContent(IBindableIocService service) { service.Bind <Application>().To <App>().FixResult(i => ((App)i).InitializeComponent()).AsSingleton(); service.RegisterHomeViewModel <HomeScreenViewModel>(); service.Bind <RootNavigationWindow>().And <Window>().And <IRootNavigationWindow>() .ToSelf().FixResult(SetIcon).AsSingleton(); }
private static void SetupPipeListener(IBindableIocService service) { service.Bind <IShutdownMonitor>().To <ShutdownMonitor>().AsSingleton(); service.Bind <IPipeListener>().And <PipeListener>().To <PipeListener>() .FixResult(i => ((PipeListener)i).Start()) .AsSingleton(); }
private static void RegisterDataStore(IBindableIocService service) { service.Bind <ICompositeVariableBinder>() .And <ISimVariableBinder>() .To <CompositeVariableBinder>().AsSingleton(); service.Bind <ISimulatorInterface>().To <SimulatorConnectionManager>().AsSingleton(); service.Bind <IVariableCache>().To <VariableCache>().AsSingleton(); }
public void Configure() { ConfigureServerConnection(); ioc.Bind <ICompositeVariableBinder>() .And <ISimVariableBinder>() .To <CompositeVariableBinder>().AsSingleton(); ioc.Bind <IVariableCache>().To <VariableCache>().AsSingleton(); }
private static void RegisterWindows(IBindableIocService service) { service.RegisterHomeViewModel <RootViewModel>(); service.Bind <INavigationWindow>().To <NavigationWindow>().AsSingleton(); service.Bind <IRootNavigationWindow>() .And <Window>() .To <RootNavigationWindow>() .AsSingleton(); service.Bind <IWindowMessageSource>().To <WindowMessageSource>().AsSingleton(); }
public static void RegisterHttpClientWithSingleSource(this IBindableIocService ioc) { ioc.Bind <HttpMessageHandler>().To <HttpClientHandler>() .DoNotDispose() .WhenConstructingType <DoNotDisposeHttpMessageHandler>(); ioc.Bind <HttpMessageHandler>().To <DoNotDisposeHttpMessageHandler>() .AsSingleton() .DisposeIfInsideScope() .BlockSelfInjection(); ioc.Bind <HttpClient>().ToSelf().WithParameters(false); }
private void RegisterTabletServer(IBindableIocService service) { service.Bind <BinaryObjectDictionary>().To <SimObjectDictionary>().AsSingleton(); service.Bind <IBinaryObjectPipeReader>().To <BinaryObjectPipeReader>( i => i.WithArgumentTypes <PipeReader, BinaryObjectDictionary>()); service.Bind <IBinaryObjectPipeWriter>().To <BinaryObjectPipeWriter>( i => i.WithArgumentTypes <PipeWriter, BinaryObjectDictionary>()); service.Bind <Func <PipeReader, PipeWriter, INetworkVariableServer> >() .ToMethod(CreateNetworkVariableServer); service.Bind <IDirectory>().ToConstant( new FileSystemDirectory($@"{AppDomain.CurrentDomain.BaseDirectory}\WASM\wwwroot")) .WhenConstructingType <LocalFileMapper>(); }
public static IActivationOptions <IConfigurationRoot> AddConfigurationSources(this IBindableIocService service, Action <IConfigurationBuilder> build) { var builder = new ConfigurationBuilder(); build(builder); return(service.Bind <IConfigurationRoot>().ToConstant(builder.Build()).DisposeIfInsideScope()); }
private static void SetupConfiguration(IBindableIocService service) { service.AddConfigurationSources(i => i.AddUserSecrets <Startup>()); service.Bind <IList <TargetSite> >().To <List <TargetSite> >(ConstructorSelectors.DefaultConstructor) .InitializeFromConfiguration("Links") .AsSingleton(); }
public static IActivationOptions <ILogger> AddLogging(this IBindableIocService service) { Serilog.Log.Logger = new LoggerConfiguration() .WriteTo.NamedPipe() .MinimumLevel.Debug() .WriteTo.Console() .CreateLogger(); return(service.Bind <ILogger>().ToConstant(Serilog.Log.Logger)); }
private void RegisterDebugger(IBindableIocService service) { service.Bind <Func <object, IRootNavigationWindow> >().ToConstant(o => { var navWindow = new NavigationWindow(); navWindow.NavigateTo(o); return(new RootNavigationWindow(navWindow)); }); }
protected override void RegisterWithIocContainer(IBindableIocService service) { service.AddLogging(); service.Bind <SamplesTreeViewModel>().ToSelf().AsSingleton(); service.RegisterHomeViewModel <SamplesTreeViewModel>(); service.Bind <IRootNavigationWindow>() .And <Window>() .To <RootNavigationWindow>() .AsSingleton(); service.Bind <DisposableDependency>().ToSelf().AsScoped(); service.Bind <IWindowMessageSource>().To <WindowMessageSource>().AsSingleton(); // pedal reader service.Bind <IMonitorForDeviceArrival>().To <MonitorForDeviceArrival>() .AsSingleton().DoNotDispose(); service.Bind <ITranscriptonPedal>().To <TranscriptonPedal>() .DoNotDispose(); service.Bind <IDetectThumbDrive>().To <DetectThumbDrive>().AsSingleton().DoNotDispose(); }
protected override void RegisterWithIocContainer(IBindableIocService service) { service.AddLogging(); // window selectors service.Bind <IFileViewerFactory>().To <NugetManagerViewModelFactory>(); service.Bind <IFileViewerFactory>().To <SecretManagerViewModelFactory>(); // Root Window service.Bind <INavigationWindow>().To <NavigationWindow>().AsSingleton(); service.Bind <RootNavigationWindow>().And <Window>().And <IRootNavigationWindow>() .ToSelf().FixResult(SetIcon).AsSingleton(); service.RegisterHomeViewModel <FileLoadViewModel>(); // System Services service.Bind <IStartupData>().To <StartupData>() .WithParameters(new object[] { CommandLineParameters }) .AsSingleton(); service.Bind <IOpenSaveFile>().To <OpenSaveFileAdapter>(); }
private static void RegisterHardware(IBindableIocService service) { service.Bind <IYokeConnection>().To <YokeConnection>().AsSingleton(); service.Bind <IMonitorForDeviceArrival>().To <MonitorForDeviceArrival>().DisposeIfInsideScope(); }
public static IActivationOptions <AsyncFunctionFactoryImplementation <T> > BindAsyncFactory <T>(this IBindableIocService service) => service.Bind <AsyncFunctionFactoryImplementation <T> >().ToSelf();
public static IActivationOptions <IHomeViewModelFactory> RegisterHomeViewModel( this IBindableIocService ioc, Func <IIocService, object?> creator) { return(ioc.Bind <IHomeViewModelFactory>() .ToConstant(new HomeViewModelFactoryNonDefaultImplementation(creator))); }
private static void RegisterAirportDatabase(IBindableIocService service) { service.Bind <Func <AirportDbContext> >().ToConstant(AirportContext()); service.Bind <IAirportRepository>().To <AirportSqlRepository>(); }