public void LoadList() { if (ModuleConfig.StorageType == StorageType.MySql) { Translation.CreateMySqlTableIfNotExists(); var query = @"SELECT * FROM `tmodule_translations`"; Task.Factory.StartNew(() => { return(Query.ExecuteMySql(query).Rows); }).ContinueWith((rows) => { Parallel.ForEach(rows.Result.Cast <DataRow>(), (row) => { dictionaries.AddTranslation(new Translation { Id = Convert.ToInt32(row["id"].ToString()), FormControlID = Convert.ToInt32(row["form_control_id"].ToString()), LanguageID = Convert.ToInt32(row["language_id"].ToString()), TranslatedText = row["translated_text"].ToString() }); }); }).Wait(); // foreach (DataRow row in Query.ExecuteMySql(query).Rows) // { // Translations.Add(new Translation // { // Id = Convert.ToInt32(row["id"].ToString()), // FormControlID = Convert.ToInt32(row["form_control_id"].ToString()), // LanguageID = Convert.ToInt32(row["language_id"].ToString()), // TranslatedText = row["translated_text"].ToString() // }); // } } IsLoaded = true; }