Exemple #1
0
        public List <BaseLevel> GetBaseLevels()
        {
            List <BaseLevel> levels = new List <BaseLevel>();

            using (var dbHelper = new GameDBHelper(MAIN_DATABASE_PATH, MAIN_PACKS_FOLDER_PATH))
            {
                var installedLevels = dbHelper.GetLevels();
                levels.AddRange(installedLevels.Values.Where(m => m.Language.Equals(LanguagesUtils.GetCurrentLanguageOnQuizzAppFormat(), StringComparison.InvariantCultureIgnoreCase)));
            }

            //// Debug purpose
            //levels.Add(levels[0]);
            //levels.Add(levels[0]);
            //levels.Add(levels[0]);
            //levels.Add(levels[0]);
            //levels.Add(levels[0]);
            //levels.Add(levels[0]);
            //levels.Add(levels[0]);
            //levels.Add(levels[0]);
            //levels.Add(levels[0]);
            //levels.Add(levels[0]);
            //levels.Add(levels[0]);

            return(levels);
        }
Exemple #2
0
        public List <Difficulty> GetDifficulties()
        {
            //List<Difficulty> difficulties = new List<Difficulty>();
            //if (this.LastInitInfosRep != null)
            //    difficulties = this.LastInitInfosRep.Difficulties.Where(m => m.Language.Value.Equals(Utils.GetCurrentLanguageOnQuizzAppFormat(), StringComparison.InvariantCultureIgnoreCase)).ToList();

            using (var dbHelper = new GameDBHelper(MAIN_DATABASE_PATH, MAIN_PACKS_FOLDER_PATH))
            {
                var installedDifficulties = dbHelper.GetDifficulties();
                return(installedDifficulties.Values.Where(m => m.Language.Equals(LanguagesUtils.GetCurrentLanguageOnQuizzAppFormat(), StringComparison.InvariantCultureIgnoreCase)).ToList());
            }
        }
 private void Button_English_Click(object sender, RoutedEventArgs e)
 {
     Debug.WriteLine(LanguagesUtils.GetCurrentLanguageOnQuizzAppFormat());
     if (LanguagesUtils.GetCurrentLanguageOnQuizzAppFormat().Equals(Constants.FR_IDENTIFIER, StringComparison.InvariantCultureIgnoreCase))
     {
         LanguagesUtils.SetCurrentLanguage(Constants.EN_CU);
         DisplayRestartMessage();
     }
     else if (LinkedPrompt != null)
     {
         // Close
         LinkedPrompt.Hide();
     }
 }
Exemple #4
0
        public async Task <List <LevelDl> > GetDlLevelListAsync(bool forceRefreshFromServer)
        {
            if (this.LastDlLevelsListTime != null && this.toDlLevels != null && forceRefreshFromServer == false)
            {
                return(this.toDlLevels);
            }

            if (await RefreshDlLevelListAsync())
            {
                var filteredList = this.toDlLevels.Where(m => m.Language.Equals(LanguagesUtils.GetCurrentLanguageOnQuizzAppFormat(), StringComparison.InvariantCultureIgnoreCase)).ToList();
                return(filteredList);
            }
            else
            {
                return(new List <LevelDl>());
            }
        }
Exemple #5
0
        private async Task <bool> RefreshInitInfosAsync(bool updateIndicatorOfAllPacks)
        {
            try
            {
                JsonWebClient client = new JsonWebClient();
                InitInfosRep  resp   = await client.DoRequestJsonAsync <InitInfosRep>(QUIZZ_APP_INIT_BASE_URL + "/" + QUIZZ_APP_SERVICE_INFO + "/" + QUIZZ_APP_MEDIA_TYPE_IDENTIFIER);

                this.LastInitInfosRep     = resp;
                this.LastInitInfosRepTime = DateTime.Now;

                // Inject dificulties
                if (this.LastInitInfosRep == null)
                {
                    return(false);
                }

                var difficulties = this.LastInitInfosRep.Difficulties.Where(m => m.Language.Value.Equals(LanguagesUtils.GetCurrentLanguageOnQuizzAppFormat(), StringComparison.InvariantCultureIgnoreCase)).ToList();
                using (var dbHelper = new GameDBHelper(MAIN_DATABASE_PATH, MAIN_PACKS_FOLDER_PATH))
                {
                    var installedDifficulties = dbHelper.GetDifficulties();
                    foreach (var item in difficulties)
                    {
                        if (!installedDifficulties.ContainsKey(item.Difficulty.Id))
                        {
                            dbHelper.AddDifficulty(item);
                        }
                    }

                    var toto = dbHelper.GetDifficulties();
                }



                //if (updateIndicatorOfAllPacks)
                //    this.UpdateIndicatorNewOfPacks();

                return(true);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error doing 'init' on server!!", ex);
                return(false);
            }
        }
 public ChooseLanguagePopupContentControl()
 {
     InitializeComponent();
     Debug.WriteLine(LanguagesUtils.GetCurrentLanguageOnQuizzAppFormat());
 }