Beispiel #1
0
 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();
 }
Beispiel #2
0
 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();
 }
Beispiel #3
0
 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();
 }
Beispiel #4
0
 public void Configure()
 {
     ConfigureServerConnection();
     ioc.Bind <ICompositeVariableBinder>()
     .And <ISimVariableBinder>()
     .To <CompositeVariableBinder>().AsSingleton();
     ioc.Bind <IVariableCache>().To <VariableCache>().AsSingleton();
 }
Beispiel #5
0
 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);
 }
Beispiel #7
0
 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>();
 }
Beispiel #8
0
        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());
        }
Beispiel #9
0
 private static void SetupConfiguration(IBindableIocService service)
 {
     service.AddConfigurationSources(i => i.AddUserSecrets <Startup>());
     service.Bind <IList <TargetSite> >().To <List <TargetSite> >(ConstructorSelectors.DefaultConstructor)
     .InitializeFromConfiguration("Links")
     .AsSingleton();
 }
Beispiel #10
0
 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));
 }
Beispiel #11
0
 private void RegisterDebugger(IBindableIocService service)
 {
     service.Bind <Func <object, IRootNavigationWindow> >().ToConstant(o =>
     {
         var navWindow = new NavigationWindow();
         navWindow.NavigateTo(o);
         return(new RootNavigationWindow(navWindow));
     });
 }
Beispiel #12
0
        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();
        }
Beispiel #13
0
        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>();
        }
Beispiel #14
0
 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)));
 }
Beispiel #17
0
 private static void RegisterAirportDatabase(IBindableIocService service)
 {
     service.Bind <Func <AirportDbContext> >().ToConstant(AirportContext());
     service.Bind <IAirportRepository>().To <AirportSqlRepository>();
 }