コード例 #1
0
ファイル: App.xaml.cs プロジェクト: Michael-Z/DriveHud
        private void Initialize()
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;

            VisualStudio2013Palette.LoadPreset(VisualStudio2013Palette.ColorVariation.Dark);
            ResourceRegistrator.Initialization();

            /* Without this user won't be able to input decimal point for float bindings if UpdateSourceTrigger set to PropertyChanged */
            System.Windows.FrameworkCompatibilityPreferences.KeepTextBoxDisplaySynchronizedWithTextProperty = false;

            unityContainer = new UnityContainer();

            unityContainer.RegisterType <IEventAggregator, EventAggregator>(new ContainerControlledLifetimeManager());
            unityContainer.RegisterType <IHudServiceHost, HudServiceHost>(new ContainerControlledLifetimeManager());
            unityContainer.RegisterType <IDataService, DataService>(new ContainerControlledLifetimeManager());
            unityContainer.RegisterType <ISettingsService, SettingsService>(new ContainerControlledLifetimeManager(), new InjectionConstructor(StringFormatter.GetAppDataFolderPath()));
            unityContainer.RegisterType <IHandHistoryParserFactory, HandHistoryParserFactoryImpl>();

            UnityServicesBootstrapper.ConfigureContainer(unityContainer);
            ModelBootstrapper.ConfigureContainer(unityContainer);

            var locator = new UnityServiceLocator(unityContainer);

            ServiceLocator.SetLocatorProvider(() => locator);

            RuntimeTypeModel.Default.Add(typeof(System.Windows.Point), false).SetSurrogate(typeof(PointDto));
            RuntimeTypeModel.Default.Add(typeof(System.Windows.Media.Color), false).SetSurrogate(typeof(ColorDto));
            RuntimeTypeModel.Default.Add(typeof(System.Windows.Media.SolidColorBrush), false).SetSurrogate(typeof(SolidColorBrushDto));
        }
コード例 #2
0
ファイル: Bootstrapper.cs プロジェクト: Michael-Z/DriveHud
        public void Run()
        {
            ResourceRegistrator.Initialization();

            UnityContainer = new UnityContainer();

            UnityContainer.RegisterType <ISettingsService, SettingsService>(new ContainerControlledLifetimeManager(), new InjectionConstructor(StringFormatter.GetAppDataFolderPath()));
            ModelBootstrapper.ConfigureContainer(UnityContainer);

            var locator = new UnityServiceLocator(UnityContainer);

            ServiceLocator.SetLocatorProvider(() => locator);
        }
コード例 #3
0
        protected override void ConfigureContainer()
        {
            base.ConfigureContainer();

            Container.RegisterType <SingletonStorageModel>(new ContainerControlledLifetimeManager());

            RegisterTypeIfMissing(typeof(ISQLiteBootstrapper), typeof(SQLiteBootstrapper), false);
            RegisterTypeIfMissing(typeof(IDataService), typeof(DataService), true);
            RegisterTypeIfMissing(typeof(ISiteConfigurationService), typeof(SiteConfigurationService), true);
            RegisterTypeIfMissing(typeof(IHandHistoryParserFactory), typeof(HandHistoryParserFactoryImpl), false);
            RegisterTypeIfMissing(typeof(ILicenseService), typeof(LicenseService), true);
            RegisterTypeIfMissing(typeof(IHudElementViewModelCreator), typeof(HudElementViewModelCreator), false);
            RegisterTypeIfMissing(typeof(IHudLayoutsService), typeof(HudLayoutsService), true);
            RegisterTypeIfMissing(typeof(IReplayerTableConfigurator), typeof(ReplayerTableConfigurator), false);
            RegisterTypeIfMissing(typeof(IReplayerService), typeof(ReplayerService), true);
            RegisterTypeIfMissing(typeof(ISessionService), typeof(SessionService), true);
            RegisterTypeIfMissing(typeof(IHudTransmitter), typeof(HudTransmitter), true);
            RegisterTypeIfMissing(typeof(ILayoutMigrator), typeof(LayoutMigrator), false);
            RegisterTypeIfMissing(typeof(ITreatAsService), typeof(TreatAsService), true);
            RegisterTypeIfMissing(typeof(IModuleService), typeof(ModuleService), false);
            RegisterTypeIfMissing(typeof(IWindowController), typeof(WindowController), true);
            RegisterTypeIfMissing(typeof(ICurrencyRatesService), typeof(CurrencyRatesService), false);

            // Migration
            Container.RegisterType <IMigrationService, SQLiteMigrationService>(DatabaseType.SQLite.ToString());
            Container.RegisterType <IMigrationService, PostgresMigrationService>(DatabaseType.PostgreSQL.ToString());

            // Sites configurations
            Container.RegisterType <ISiteConfiguration, BovadaConfiguration>(EnumPokerSites.Ignition.ToString());
            Container.RegisterType <ISiteConfiguration, BetOnlineConfiguration>(EnumPokerSites.BetOnline.ToString());
            Container.RegisterType <ISiteConfiguration, TigerGamingConfiguration>(EnumPokerSites.TigerGaming.ToString());
            Container.RegisterType <ISiteConfiguration, SportsBettingConfiguration>(EnumPokerSites.SportsBetting.ToString());
            Container.RegisterType <ISiteConfiguration, PokerStarsConfiguration>(EnumPokerSites.PokerStars.ToString());
            Container.RegisterType <ISiteConfiguration, Poker888Configuration>(EnumPokerSites.Poker888.ToString());
            Container.RegisterType <ISiteConfiguration, AmericasCardroomConfiguration>(EnumPokerSites.AmericasCardroom.ToString());
            Container.RegisterType <ISiteConfiguration, BlackChipPokerConfiguration>(EnumPokerSites.BlackChipPoker.ToString());
            Container.RegisterType <ISiteConfiguration, TruePokerConfiguration>(EnumPokerSites.TruePoker.ToString());
            Container.RegisterType <ISiteConfiguration, YaPokerConfiguration>(EnumPokerSites.YaPoker.ToString());
            Container.RegisterType <ISiteConfiguration, WPNConfiguration>(EnumPokerSites.WinningPokerNetwork.ToString());
            Container.RegisterType <ISiteConfiguration, IPokerConfiguration>(EnumPokerSites.IPoker.ToString());
            Container.RegisterType <ISiteConfiguration, PartyPokerConfiguration>(EnumPokerSites.PartyPoker.ToString());
            Container.RegisterType <ISiteConfiguration, HorizonConfiguration>(EnumPokerSites.Horizon.ToString());
            Container.RegisterType <ISiteConfiguration, WinamaxConfiguration>(EnumPokerSites.Winamax.ToString());
            Container.RegisterType <ISiteConfiguration, Adda52SiteConfiguration>(EnumPokerSites.Adda52.ToString());
            Container.RegisterType <ISiteConfiguration, SpartanPokerConfiguration>(EnumPokerSites.SpartanPoker.ToString());
            Container.RegisterType <ISiteConfiguration, PokerBaaziSiteConfiguration>(EnumPokerSites.PokerBaazi.ToString());

            // HUD designer
            Container.RegisterType <IHudToolFactory, HudToolFactory>();

            // HUD panel services
            UnityServicesBootstrapper.ConfigureContainer(Container);

            // Model services
            ModelBootstrapper.ConfigureContainer(Container);

            // API services
            APIServicesBootstrapper.ConfigureContainer(Container);

            // Licenses
            Container.RegisterType <ILicenseManager, DHTReg>(LicenseType.Trial.ToString());
            Container.RegisterType <ILicenseManager, DHHReg>(LicenseType.Holdem.ToString());
            Container.RegisterType <ILicenseManager, DHOReg>(LicenseType.Omaha.ToString());
            Container.RegisterType <ILicenseManager, DHCReg>(LicenseType.Combo.ToString());

            //Settings
            Container.RegisterType <ISettingsService, SettingsService>(new ContainerControlledLifetimeManager(), new InjectionConstructor(StringFormatter.GetAppDataFolderPath()));
            Container.RegisterType <ICashGraphSettingsService, CashGraphSettingsService>(new ContainerControlledLifetimeManager());

            // Settings Table Configurators
            Container.RegisterType <ISiteSettingTableConfigurator, BovadaSiteSettingTableConfigurator>(EnumPokerSites.Ignition.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, CommonSiteSettingTableConfigurator>(EnumPokerSites.BetOnline.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, CommonSiteSettingTableConfigurator>(EnumPokerSites.TigerGaming.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, CommonSiteSettingTableConfigurator>(EnumPokerSites.SportsBetting.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, PokerStarsSiteSettingTableConfigurator>(EnumPokerSites.PokerStars.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, Poker888SiteSettingTableConfigurator>(EnumPokerSites.Poker888.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, WinningPokerNetworkSiteSettingTableConfigurator>(EnumPokerSites.AmericasCardroom.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, WinningPokerNetworkSiteSettingTableConfigurator>(EnumPokerSites.BlackChipPoker.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, WinningPokerNetworkSiteSettingTableConfigurator>(EnumPokerSites.TruePoker.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, WinningPokerNetworkSiteSettingTableConfigurator>(EnumPokerSites.YaPoker.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, WinningPokerNetworkSiteSettingTableConfigurator>(EnumPokerSites.WinningPokerNetwork.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, PartyPokerSiteSettingTableConfigurator>(EnumPokerSites.PartyPoker.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, IPokerSiteSettingTableConfigurator>(EnumPokerSites.IPoker.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, GGNSiteSettingTableConfigurator>(EnumPokerSites.GGN.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, HorizonSiteSettingTableConfigurator>(EnumPokerSites.Horizon.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, WinamaxSiteSettingTableConfigurator>(EnumPokerSites.Winamax.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, Adda52SiteSettingTableConfiguration>(EnumPokerSites.Adda52.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, CommonSiteSettingTableConfigurator>(EnumPokerSites.SpartanPoker.ToString());
            Container.RegisterType <ISiteSettingTableConfigurator, CommonSiteSettingTableConfigurator>(EnumPokerSites.PokerBaazi.ToString());

            // Series providers
            Container.RegisterType <IGraphsProvider, GraphsProvider>();
            Container.RegisterType <IGraphSeriesProvider, WinningByMonthSeriesProvider>(SerieType.WinningsByMonth.ToString());
            Container.RegisterType <IGraphSeriesProvider, WinningByYearSeriesProvider>(SerieType.WinningsByYear.ToString());
            Container.RegisterType <IGraphSeriesProvider, MoneyWinByCashGameTypeSeriesProvider>(SerieType.MoneyWonByCashGameType.ToString());
            Container.RegisterType <IGraphSeriesProvider, MoneyWinByTournamentGameTypeSeriesProvider>(SerieType.MoneyWonByTournamentGameType.ToString());
            Container.RegisterType <IGraphSeriesProvider, EVDiffToRealizedEvByMonthSeriesProvider>(SerieType.EVDiffToRealizedEVByMonth.ToString());
            Container.RegisterType <IGraphSeriesProvider, Top20BiggestLosingHandsSeriesProvider>(SerieType.Top20BiggestLosingHands.ToString());
            Container.RegisterType <IGraphSeriesProvider, Top20BiggestWinningHandsSeriesProvider>(SerieType.Top20BiggestWinningHands.ToString());
            Container.RegisterType <IGraphSeriesProvider, MoneyWonByPositionSeriesProvider>(SerieType.MoneyWonByPosition.ToString());
            Container.RegisterType <IGraphSeriesProvider, BB100ByTimeOfDaySeriesProvider>(SerieType.BB100ByTimeOfDay.ToString());
            Container.RegisterType <IGraphSeriesProvider, Top20ToughestOpponentsByLossAmountSeriesProvider>(SerieType.Top20ToughestOpponents.ToString());

            // Register views containers
            Container.RegisterType <IViewModelContainer, CashGraphPopupView>(RegionViewNames.CashGraphPopupView);
            Container.RegisterType <IViewModelContainer, HudUploadToStoreView>(RegionViewNames.HudUploadToStoreView);
            Container.RegisterType <IViewModelContainer, FilterEditValuePopupView>(RegionViewNames.FilterEditValuePopupView);

            // Register view models
            Container.RegisterType <ICashGraphPopupViewModel, CashGraphPopupViewModel>();
            Container.RegisterType <IHudUploadToStoreViewModel, HudUploadToStoreViewModel>();
            Container.RegisterType <IFilterEditValuePopupViewModel, FilterEditValuePopupViewModel>();

            ImporterBootstrapper.ConfigureImporter(Container);
        }