From f63cbb4c2606dbfd1d4335c57984293ba65aed70 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Thu, 28 Jul 2016 18:36:02 -0700 Subject: [PATCH] Tweak move bindingsource iteration Create datasource before the foreach to avoid multiple .Where(), possibly fixing #151 --- MainWindow/Main.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index 14d26fb00..302587a30 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -1060,10 +1060,11 @@ private void populateFilteredDataSources() CB_GameOrigin.DataSource = new BindingSource(VersionDataSource.Where(g => g.Value <= SAV.MaxGameID || SAV.Generation >= 3 && g.Value == 15), null); // Set the Move ComboBoxes too.. + var moves = MoveDataSource.Where(m => m.Value <= SAV.MaxMoveID).ToArray(); foreach (ComboBox cb in new[] { CB_Move1, CB_Move2, CB_Move3, CB_Move4, CB_RelearnMove1, CB_RelearnMove2, CB_RelearnMove3, CB_RelearnMove4 }) { cb.DisplayMember = "Text"; cb.ValueMember = "Value"; - cb.DataSource = new BindingSource(MoveDataSource.Where(m => m.Value <= SAV.MaxMoveID), null); + cb.DataSource = new BindingSource(moves, null); } } private Action getFieldsfromPKM;