Exemple #1
0
        public override void Initialize()
        {
            CreatableTypes()
            .EndingWith("Service")
            .AsInterfaces()
            .RegisterAsLazySingleton();

            Mvx.IoCProvider.RegisterSingleton(() => UserDialogs.Instance);
            RegisterAppStart <MainViewModel>();
            DataBase.SetupConnection();
            Task.Run(async() =>
            {
                await DatabaseImages.UpdateData();
                await DatabaseWords.UpdateData();
            });

            var assemblyConfig = new AssemblyContentConfig(GetType().GetTypeInfo().Assembly)
            {
                ResourceFolder = "Locales",
                ParserConfig   = new ParserConfig
                {
                    ThrowWhenKeyNotFound = true
                }
            };

            var textProvider = new MvxYamlTextProvider(assemblyConfig);

            Mvx.IoCProvider.RegisterSingleton <IMvxTextProvider>(textProvider);
            Mvx.IoCProvider.RegisterSingleton <IMvxLocalizationProvider>(textProvider);
        }
Exemple #2
0
        public override void Initialize()
        {
            this.CreatableTypes()
            .EndingWith("Service")
            .AsInterfaces()
            .RegisterAsLazySingleton();

            this.RegisterNavigationServiceAppStart <FirstViewModel>();

            Mvx.RegisterSingleton(UserDialogs.Instance);
            var assemblyConfig = new AssemblyContentConfig(this.GetType().GetTypeInfo().Assembly)
            {
                ResourceFolder = "Locales",
                ParserConfig   = new ParserConfig
                {
                    ThrowWhenKeyNotFound = true
                },
                Logger = trace => { LocaleLog.Debug(trace); }
            };

            var textProvider = new MvxYamlTextProvider(assemblyConfig);

            Mvx.RegisterSingleton <IMvxTextProvider>(textProvider);
            Mvx.RegisterSingleton <IMvxLocalizationProvider>(textProvider);
        }
Exemple #3
0
        public override void Initialize()
        {
            base.Initialize();
            Environment = new EnvironmentBuilder().SetSettings(CreateSettings()).Build();

            var assemblyConfig = new AssemblyContentConfig(GetType().GetTypeInfo().Assembly)
            {
                ResourceFolder = "Locales",
                ParserConfig   = new ParserConfig
                {
                    ThrowWhenKeyNotFound = true
                }
            };

            I18N.Initialize(assemblyConfig);

            var textProvider = new MvxLocalizationProvider(assemblyConfig);

            Mvx.IoCProvider.RegisterSingleton <IMvxTextProvider>(textProvider);
            Mvx.IoCProvider.RegisterSingleton <IMvxLocalizationProvider>(textProvider);
            Mvx.IoCProvider.RegisterSingleton <IAppSettings>(new AppSettings(Environment));
            Mvx.IoCProvider.LazyConstructAndRegisterSingleton(() => CrossConnectivity.Current);

            Mvx.IoCProvider.RegisterSingleton <IRepository>(() => new Repository());
            Mvx.IoCProvider.LazyConstructAndRegisterSingleton <ILogRepository, LogRepository>();
            Mvx.IoCProvider.LazyConstructAndRegisterSingleton <ILogWriter, LogWriter>();
            Mvx.IoCProvider.LazyConstructAndRegisterSingleton <ILogReader, LogReader>();

            var logger = Mvx.IoCProvider.Resolve <IMvxLogProvider>().GetLogFor(nameof(App));

            logger.Info("#################### Client Settings ####################");
            logger.Error("Error");
            logger.Fatal("Fatal");
            logger.Warn("Warn");
        }
        protected override void ReloadLocale()
        {
            var assemblyConfig = new AssemblyContentConfig(this.GetType().GetTypeInfo().Assembly)
            {
                ResourceFolder = "Locales"
            };

            FriendlyLocale.I18N.Initialize(assemblyConfig);
            this.ReloadItems();
        }
        public void SetUp()
        {
            var hostAssembly   = this.GetType().Assembly;
            var assemblyConfig = new AssemblyContentConfig(hostAssembly)
            {
                ResourceFolder = "Locales"
            };

            this.assemblyTranslateContentClient = new AssemblyTranslateContentClient(assemblyConfig);
        }
        public async Task Check_Multiple_Assemblies()
        {
            // Arrange
            var hostAssembly   = this.GetType().Assembly;
            var assemblyConfig = new AssemblyContentConfig(new List <Assembly> {
                hostAssembly, hostAssembly
            })
            {
                ResourceFolder = "Locales"
            };

            this.assemblyTranslateContentClient = new AssemblyTranslateContentClient(assemblyConfig);
            var locales = this.assemblyTranslateContentClient.GetLocales();

            // Act
            var contents = await this.assemblyTranslateContentClient.GetContent(locales.First(), null, new CancellationToken());

            // Assert
            Assert.AreEqual(2, contents.Length);
            foreach (var locale in locales)
            {
                Assert.AreEqual(2, (locale as AssemblyLocale)?.HostAssemblies.Count);
            }
        }
 public AssemblyTranslateContentClient(AssemblyContentConfig contentConfig)
 {
     this.contentConfig = contentConfig;
 }
Exemple #8
0
 public static ITranslateContentClient Create(
     AssemblyContentConfig contentConfig)
 {
     return(new AssemblyTranslateContentClient(contentConfig));
 }
 public MvxLocalizationProvider(AssemblyContentConfig config)
 {
     I18N.Initialize(config);
 }
Exemple #10
0
 public MvxYamlTextProvider(AssemblyContentConfig config)
 {
     I18N.Initialize(config);
 }
Exemple #11
0
 public static void Initialize(AssemblyContentConfig contentConfig)
 {
     InitializeInternal(TranslateContentClientFactory.Create(contentConfig));
 }