internal void LoadList() { Language.CreateMySqlTableIfNotExists(); if (ModuleConfig.StorageType == StorageType.MySql) { var query = @"SELECT * FROM `tmodule_languages`"; Task.Factory.StartNew(() => { return(Query.ExecuteMySql(query).Rows); }).ContinueWith((rows) => { Parallel.ForEach(rows.Result.Cast <DataRow>(), (row) => { dictionaries.AddLanguage(new Language { Id = Convert.ToInt32(row["id"].ToString()), Name = row["name"].ToString() }); }); }).Wait(); // foreach (DataRow row in Query.ExecuteMySql(query).Rows) // { // Languages.Add(new Language // { // Id = Convert.ToInt32(row["id"].ToString()), // Name = row["name"].ToString() // }); // } } IsLoaded = true; }