internal void ListDraw(string s = "") { try { List <Station> Stations = GameManager.GetAllStations(); foreach (var it in stas) { Stations.Remove(it); } foreach (Control it in panList.Controls) { StationList02 sl = it as StationList02; if (sl.isSelect) { Select.Add(sl.s); } } panList.Size = new Size(730, 0); panList.Location = new Point(0, 0); foreach (Control it in panList.Controls) { it.Dispose(); } panList.Controls.Clear(); tt.RemoveAll(); np = 1; mp = 1; _ListDraw(Stations, s); if (panList.Controls.Count <= 9) { panListBack.AutoScroll = false; panListBack.Size = new Size(730, panListBack.Height); } else { panListBack.AutoScroll = true; panListBack.Size = new Size(750, panListBack.Height); } } catch (Exception ex) { RTCore.Environment.ReportError(ex, AccessManager.AccessKey); } }
private void _ListDraw(List <Station> Stations, string s) { try { #region ListDraw int y = 0; if (s == "") { foreach (var it in Stations) { StationList02 sl = new StationList02(it); sl.Location = new Point(0, y); panList.Controls.Add(sl); y += sl.Height; panList.Size = new Size(730, y); tt.SetToolTip(sl, $"{it.Name} ({it.Parent.Parent.Name} {it.Parent.Name})"); if (Select.Contains(it)) { sl.isSelect = true; sl.BackColor = ResourceManager.Get("list.stationlist02.background.select"); } } mp = RTCore.Environment.CalcPage(Stations.Count, 9); } else { List <string> names = new List <string>(); foreach (var it in Stations) { if (names.Contains(it.Name)) { continue; } names.Add(it.Name); } List <string> result = RTAPI.StringAPI.Search(names, s); foreach (var it in Stations) { if (!result.Contains(it.Name)) { continue; } StationList02 sl = new StationList02(it); sl.Location = new Point(0, y); panList.Controls.Add(sl); y += sl.Height; panList.Size = new Size(730, y); tt.SetToolTip(sl, $"{it.Name} ({it.Parent.Parent.Name} {it.Parent.Name})"); if (Select.Contains(it)) { sl.isSelect = true; sl.BackColor = ResourceManager.Get("list.stationlist02.background.select"); } } mp = RTCore.Environment.CalcPage(result.Count, 9); } Select = new List <Station>(); #endregion } catch (Exception ex) { RTCore.Environment.ReportError(ex, AccessManager.AccessKey); } }