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