performance tweak

only do the flicker hack if the combobox is actually visible
delay form appearing until initial files are loaded
This commit is contained in:
Kurt
2017-03-29 22:23:18 -07:00
parent f2c072bc8a
commit 288aee8c3b

View File

@@ -176,7 +176,6 @@ public Main()
CB_MainLanguage.SelectedIndex = languageID;
InitializeFields();
formInitialized = true;
#endregion
#region Load Initial File(s)
@@ -220,7 +219,7 @@ public Main()
if (pkmArg != null)
openQuick(pkmArg, force: true);
// Splash Screen closes on its own.
formInitialized = true; // Splash Screen closes on its own.
BringToFront();
WindowState = FormWindowState.Minimized;
Show();
@@ -3038,13 +3037,14 @@ private void updateLegality(LegalityAnalysis la = null, bool skipMoveRepop = fal
fieldsLoaded = false;
var cb = new[] {CB_Move1, CB_Move2, CB_Move3, CB_Move4};
var moves = Legality.AllSuggestedMovesAndRelearn;
var moveList = GameInfo.MoveDataSource.OrderByDescending(m => moves.Contains(m.Value)).ToList();
var moveList = GameInfo.MoveDataSource.OrderByDescending(m => moves.Contains(m.Value)).ToArray();
foreach (ComboBox c in cb)
{
var index = WinFormsUtil.getIndex(c);
c.DataSource = new BindingSource(moveList, null);
c.SelectedValue = index;
c.SelectionLength = 0; // flicker hack
if (c.Visible)
c.SelectionLength = 0; // flicker hack
}
fieldsLoaded |= tmp;
}