public void LoadConditions(ConditionLists clist) { if (clist != null) { SuspendLayout(); this.panelOuter.SuspendLayout(); panelVScroll.SuspendLayout(); panelVScroll.RemoveAllControls(new List <Control> { buttonMore }); // except these! groups = new List <Group>(); Condition fe = null; for (int i = 0; (fe = clist.Get(i)) != null; i++) { Group g = CreateGroupInternal(fe.eventname, fe.action, fe.actiondata, fe.innercondition.ToString(), fe.outercondition.ToString()); foreach (ConditionEntry f in fe.fields) { CreateConditionInt(g, f.itemname, ConditionEntry.MatchNames[(int)f.matchtype], f.matchstring); } ExtendedControls.ThemeableFormsInstance.Instance.ApplyToControls(g.panel, SystemFonts.DefaultFont); groups.Add(g); } System.Runtime.GCLatencyMode lm = System.Runtime.GCSettings.LatencyMode; System.Runtime.GCSettings.LatencyMode = System.Runtime.GCLatencyMode.LowLatency; foreach (Group g in groups) // FURTHER investigation.. when VScroll has been used after the swap, this and fix groups takes ages { panelVScroll.Controls.Add(g.panel); // why? tried a brand new vscroll. Tried a lot of things. Is it GC? } FixUpGroups(); // this takes ages too on second load.. panelVScroll.ResumeLayout(); this.panelOuter.ResumeLayout(); ResumeLayout(); System.Runtime.GCSettings.LatencyMode = lm; } this.Text = label_index.Text = initialtitle + " (" + groups.Count.ToString() + " conditions)"; }
public void LoadConditions(ConditionLists clist) { if (clist != null) { SuspendLayout(); this.panelConditionUC.SuspendLayout(); panelVScroll.SuspendLayout(); panelVScroll.RemoveAllControls(new List <Control> { buttonMore }); // except these! groups = new List <Group>(); Condition fe = null; for (int i = 0; (fe = clist.Get(i)) != null; i++) { Group g = CreateGroupInternal(fe.eventname, fe.action, fe.actiondata, fe.innercondition.ToString(), fe.outercondition.ToString()); foreach (ConditionEntry f in fe.fields) { CreateConditionInt(g, f.itemname, ConditionEntry.MatchNames[(int)f.matchtype], f.matchstring); } groups.Add(g); } System.Runtime.GCLatencyMode lm = System.Runtime.GCSettings.LatencyMode; System.Runtime.GCSettings.LatencyMode = System.Runtime.GCLatencyMode.LowLatency; foreach (Group g in groups) // FURTHER investigation.. when VScroll has been used after the swap, this and fix groups takes ages { panelVScroll.Controls.Add(g.panel); // why? tried a brand new vscroll. Tried a lot of things. Is it GC? } FixUpGroups(); // this takes ages too on second load.. panelVScroll.ResumeLayout(); this.panelConditionUC.ResumeLayout(); ResumeLayout(); System.Runtime.GCSettings.LatencyMode = lm; } onChangeInGroups?.Invoke(groups.Count); }