Skip to content

Commit e30c17d

Browse files
author
Fraser Greenroyd
committed
Speed up project loading #46
1 parent e4bcae8 commit e30c17d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

BHoMAnalytics_UI/CaptureProjectData.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ private void Click_ProjectBtn(object sender, EventArgs e)
9696
ResetForms();
9797
ProjectInputPanel.Visibility = Visibility.Visible;
9898
this.Height = 380;
99-
//ProjectIDInput.Focus();
10099
ProjectComboBox.Focus();
101100
}
102101

@@ -257,10 +256,11 @@ private void ReadProjectInformation()
257256
var sqlAdapter = new SqlAdapter("SQL-BHoM01", "BuroHappoldData");
258257
TableRequest request = new TableRequest() { Table = "Project" };
259258
var obj = sqlAdapter.Pull(request).Cast<BH.oM.Base.CustomObject>().ToList();
259+
obj = obj.Where(x => x.CustomData["Status"].ToString().ToLower() == "active").ToList();
260260

261261
obj = obj.OrderBy(x => x.CustomData["Status"].ToString()).ThenBy(x => x.CustomData["ProjectId"].ToString()).ToList();
262262

263-
foreach (var item in obj)
263+
Parallel.ForEach(obj, item =>
264264
{
265265
string projectInfo = $"{item.CustomData["ProjectId"].ToString()} - {item.Name}";
266266

@@ -271,7 +271,7 @@ private void ReadProjectInformation()
271271
projectInfo += " - INACTIVE";
272272

273273
AllProjectData.Add(projectInfo);
274-
}
274+
});
275275

276276
_loadedProjectData = AllProjectData.ToList();
277277
}

0 commit comments

Comments
 (0)