Пример #1
0
        public override void Initialize()
        {
            Barrel.ApplicationId = "Chameleon";

            Mvx.IoCProvider.RegisterSingleton <IBarrel>(Barrel.Current);
            Mvx.IoCProvider.RegisterSingleton <IUserDialogs>(UserDialogs.Instance);
            Mvx.IoCProvider.RegisterSingleton <IMediaManager>(CrossMediaManager.Current);

            // Register Text provider
            var textProviderBuilder = new TextProviderBuilder();

            Mvx.IoCProvider.RegisterSingleton <IMvxTextProviderBuilder>(textProviderBuilder);
            Mvx.IoCProvider.RegisterSingleton <IMvxTextProvider>(textProviderBuilder.TextProvider);

            Mvx.IoCProvider.LazyConstructAndRegisterSingleton <IPlaylistService, PlaylistService>();

            CreatableTypes()
            .EndingWith("Service")
            .AsInterfaces()
            .RegisterAsLazySingleton();

            /*var language = Mvx.IoCProvider.Resolve<ILanguageService>()?.GetLanguage()?.TwoLetterISOLanguageName;
             * var textProviderBuilder = ((TextProviderBuilder)Mvx.IoCProvider.GetSingleton<IMvxTextProviderBuilder>());
             * if (textProviderBuilder.CurrentLocalization != language)
             *  textProviderBuilder.LoadResources(language);*/

            FFImageLoading.ImageService.Instance.Initialize();

            RegisterCustomAppStart <AppStart>();
        }
Пример #2
0
        public override void Initialize()
        {
            Barrel.ApplicationId = "Chameleon";

            Mvx.IoCProvider.RegisterSingleton <IBarrel>(Barrel.Current);
            Mvx.IoCProvider.RegisterSingleton <IUserDialogs>(UserDialogs.Instance);

            // Register Text provider
            var textProviderBuilder = new TextProviderBuilder();

            Mvx.IoCProvider.RegisterSingleton <IMvxTextProviderBuilder>(textProviderBuilder);
            var textProvider = textProviderBuilder.TextProvider;

            Mvx.IoCProvider.RegisterSingleton <IMvxTextProvider>(textProvider);

            CreatableTypes()
            .EndingWith("Service")
            .AsInterfaces()
            .RegisterAsLazySingleton();

            var mediaManager = CrossMediaManager.Current;

            Mvx.IoCProvider.RegisterSingleton <IMediaManager>(mediaManager);

            var playlists = Mvx.IoCProvider.IoCConstruct <PlaylistProvider>();

            var exoplayer = Mvx.IoCProvider.IoCConstruct <ExoplayerProvider>();

            exoplayer.Title = textProvider.GetText(AppSettings.TextProviderNamespace, "ProvidersOverviewViewModel", "Exoplayer");

            var urlSources = Mvx.IoCProvider.IoCConstruct <UrlSourcesProvider>();

            urlSources.Title = textProvider.GetText(AppSettings.TextProviderNamespace, "ProvidersOverviewViewModel", "UrlSource");

            var radioStations = Mvx.IoCProvider.IoCConstruct <RadioStationProvider>();

            radioStations.Title = textProvider.GetText(AppSettings.TextProviderNamespace, "ProvidersOverviewViewModel", "RadioStations");

            mediaManager.Library.Providers.Add(playlists);
            mediaManager.Library.Providers.Add(exoplayer);
            mediaManager.Library.Providers.Add(urlSources);
            mediaManager.Library.Providers.Add(radioStations);

            Mvx.IoCProvider.LazyConstructAndRegisterSingleton <IBrowseService, BrowseService>();
            Mvx.IoCProvider.LazyConstructAndRegisterSingleton <ISettingsService, SettingsService>();
            Mvx.IoCProvider.LazyConstructAndRegisterSingleton <IThemeService, ThemeServiceBase>();

            /*var language = Mvx.IoCProvider.Resolve<ILanguageService>()?.GetLanguage()?.TwoLetterISOLanguageName;
             * var textProviderBuilder = ((TextProviderBuilder)Mvx.IoCProvider.GetSingleton<IMvxTextProviderBuilder>());
             * if (textProviderBuilder.CurrentLocalization != language)
             *  textProviderBuilder.LoadResources(language);*/

            FFImageLoading.ImageService.Instance.Initialize();
            FFImageLoading.ImageService.Instance.Config.DelayInMs = 200;
            Mvx.IoCProvider.Resolve <IThemeService>().UpdateTheme();

            RegisterCustomAppStart <AppStart>();
        }