Exemplo n.º 1
0
        protected override void ConfigureContainer()
        {
            base.ConfigureContainer();

            // Vertical components
            Container.ConfigureSerilogILogger(Log.Logger);
            Container.Register <IEventAggregator, EventAggregator>(Reuse.Singleton, null, null, IfAlreadyRegistered.Replace, "EventAggregator");
            Container.Register <ISettingsStorage, JsonSettingsStorage>(Reuse.Singleton);
            Container.Register <IAppConfiguration, CapFrameXConfiguration>(Reuse.Singleton);
            Container.RegisterInstance <IFrametimeStatisticProviderOptions>(Container.Resolve <IAppConfiguration>());
            Container.RegisterInstance(new ApplicationState(), Reuse.Singleton);

            // Prism
            Container.Register <IRegionManager, RegionManager>(Reuse.Singleton, null, null, IfAlreadyRegistered.Replace, "RegionManager");

            // Core components
            Container.Register <IRecordDirectoryObserver, RecordDirectoryObserver>(Reuse.Singleton);
            Container.Register <IStatisticProvider, FrametimeStatisticProvider>(Reuse.Singleton);
            Container.Register <IFrametimeAnalyzer, FrametimeAnalyzer>(Reuse.Singleton);
            Container.Register <ICaptureService, PresentMonCaptureService>(Reuse.Singleton);
            Container.Register <IRTSSService, RTSSService>(Reuse.Singleton);
            Container.Register <IOverlayEntryCore, OverlayEntryCore>(Reuse.Singleton);
            Container.Register <IOverlayService, OverlayService>(Reuse.Singleton);
            Container.Register <IOnlineMetricService, OnlineMetricService>(Reuse.Singleton);
            Container.Register <ISensorService, SensorService>(Reuse.Singleton);
            Container.Register <ISensorConfig, SensorConfig>(Reuse.Singleton);
            Container.Register <ISensorEntryProvider, SensorEntryProvider>(Reuse.Singleton);
            Container.Register <IOverlayEntryProvider, OverlayEntryProvider>(Reuse.Singleton);
            Container.Register <IRecordManager, RecordManager>(Reuse.Singleton);
            Container.Register <ISystemInfo, SystemInfo>(Reuse.Singleton);
            Container.Register <IAppVersionProvider, AppVersionProvider>(Reuse.Singleton);
            Container.RegisterInstance <IWebVersionProvider>(new WebVersionProvider(), Reuse.Singleton);
            Container.Register <IUpdateCheck, UpdateCheck>(Reuse.Singleton);
            Container.Register <LoginManager>(Reuse.Singleton);
            Container.Register <ICloudManager, CloudManager>(Reuse.Singleton);
            Container.Register <LoginWindow>(Reuse.Transient);
            Container.RegisterInstance(ProcessList.Create(
                                           filename: Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"CapFrameX\Resources\Processes.json"),
                                           appConfiguration: Container.Resolve <IAppConfiguration>()));
            Container.Register <SoundManager>(Reuse.Singleton);
            Container.Resolve <IEventAggregator>().GetEvent <PubSubEvent <AppMessages.OpenLoginWindow> >().Subscribe(_ => {
                var window = Container.Resolve <LoginWindow>();
                window.Show();
            });
            Container.Register <CaptureManager>(Reuse.Singleton);
        }