Skip to content

Commit 3768acd

Browse files
robertlong13meee1
authored andcommitted
ConfigRawParams: fix search slowdown
1 parent 8104697 commit 3768acd

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

GCSViews/ConfigurationView/ConfigRawParams.Designer.cs

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GCSViews/ConfigurationView/ConfigRawParams.cs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using log4net;
1+
using log4net;
22
using MissionPlanner.Controls;
33
using MissionPlanner.Utilities;
44
using System;
@@ -588,9 +588,8 @@ internal void processToScreen()
588588

589589
log.Info("about to add all");
590590

591-
Params.SuspendLayout();
591+
SuspendParamGridView();
592592
Params.Visible = false;
593-
Params.Enabled = false;
594593

595594
Params.Rows.AddRange(rowlist.ToArray());
596595

@@ -600,9 +599,8 @@ internal void processToScreen()
600599

601600
Params.Sort(Params.Columns[Command.Index], ListSortDirection.Ascending);
602601

603-
Params.Enabled = true;
604602
Params.Visible = true;
605-
Params.ResumeLayout();
603+
ResumeParamGridView();
606604

607605
if (splitContainer1.Panel1Collapsed == false)
608606
{
@@ -712,8 +710,7 @@ private void updatedefaultlist(object crap)
712710
void filterList(string searchfor)
713711
{
714712
DateTime start = DateTime.Now;
715-
Params.SuspendLayout();
716-
Params.Enabled = false;
713+
SuspendParamGridView();
717714
if (searchfor.Length >= 2 || searchfor.Length == 0)
718715
{
719716
Regex filter = new Regex(searchfor.Replace("*", ".*").Replace("..*", ".*"), RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline);
@@ -762,8 +759,7 @@ void filterList(string searchfor)
762759
}
763760
}
764761

765-
Params.Enabled = true;
766-
Params.ResumeLayout();
762+
ResumeParamGridView();
767763

768764
log.InfoFormat("Filter: {0}ms", (DateTime.Now - start).TotalMilliseconds);
769765
}
@@ -1171,6 +1167,20 @@ private void Params_ColumnWidthChanged(object sender, DataGridViewColumnEventArg
11711167
optionsControlUpateBounds();
11721168
}
11731169
}
1170+
1171+
void SuspendParamGridView()
1172+
{
1173+
Params.SuspendLayout();
1174+
Params.Enabled = false;
1175+
Params.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
1176+
}
1177+
1178+
void ResumeParamGridView()
1179+
{
1180+
Params.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
1181+
Params.Enabled = true;
1182+
Params.ResumeLayout();
1183+
}
11741184
}
11751185

11761186
}

0 commit comments

Comments
 (0)