Пример #1
0
 private async Task UpdateLanguageList(Languages languages)
 {
     LanguageList list = languages.GetLanguageListFromFile(new LanguageList());
     if (list.LastUpdated.AddDays(7) < DateTime.Now)
     {
         //await UpdateUI("Updating your language list. Wait just a moment.");
         await languages.UpdateLanguageList(new LanguageList());
     }
 }
Пример #2
0
 private async Task<bool> NeedsInitializationOrUpdate(Languages languages)
 {
     if (!languages.LanguageListExists() || (!await languages.IsLanguageDownloaded(ApplicationData.Current.RoamingSettings.Values["primary"].ToString())))
     {
         //Needs initialization
         return true;
     }
     else
     {
         //Needs Update
         return false;
     }
 }
        async void DismissExtendedSplash()
        {
            Languages languages = new Languages();

            bool test = await languages.IsLanguageDownloaded(ApplicationData.Current.RoamingSettings.Values["primary"].ToString());
            System.Diagnostics.Debug.WriteLine("Is translation of Default language done? " + test);

            System.Diagnostics.Debug.WriteLine("Navigating to MainPage");
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                () =>
                {
                    // Navigate to mainpage
                    rootFrame.Navigate(typeof(MainPage));
                    // Place the frame in the current Window
                    Window.Current.Content = rootFrame;
                });
        }
Пример #4
0
        private async Task InitializeTranslations(Languages languages, TranslationConfigs translationService)
        {
            string listLanguage = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;
            string listLanguageName = CultureInfo.CurrentUICulture.NativeName;

            UpdateUI("downloading your first language, which happens to be " + listLanguageName + "\ngo to settings to add more languages");

            await languages.CreateLanguageFile(new LanguageList());
            UpdateUI("language list created");
            List<Language> list = languages.GetLanguageListFromFile(new LanguageList()).Languages;

            //Populate Default language first
            
            UpdateUI("getting " + listLanguageName);
            await ProcessTranslation(listLanguage, list.Find(l => l.code == listLanguage).packages, translationService);

            if (await languages.IsLanguageDownloaded(listLanguage) == false)
            {
                UpdateUI(listLanguageName + " is downloading");
                await languages.DownloadLanguage(listLanguage);
            }

            UpdateUI("looking at other languages\n\ngo to settings to download more languages");
            foreach (Language language in list)
            {
                await ProcessTranslation(language.code, language.packages, translationService);
            }

            UpdateUI("done! moving on");

            await CheckStatus();
        }