private bool SetNextView() { ListForShow lstC = lst[currentList]; if (lstC.Current < 0) { lstC.Current = 0; } else { lstC.Current += screenSize; } if (!RefreshCurrent()) { return(false); } if (lstC.Current >= lstC.Length) { lstC.Current = -1; return(false); } bool bRes = true; if (listView.InvokeRequired) { listView.Invoke(new EventHandler(delegate { bRes = RefreshListView(lstC); })); } else { bRes = RefreshListView(lstC); } return(bRes); }
private bool RefreshCurrentScreen() { if (currentList < 0 || currentList >= lst.Count) { return(false); } ListForShow ls = lst[currentList]; bool res = false; if (listView.InvokeRequired) { listView.Invoke(new EventHandler(delegate { listView.Items.Clear(); for (int i = ls.Current; i < (ls.Current + screenSize) && i < ls.Data.Rows.Count; i++) { listView.Items.Add(ls.Data.Rows[i][0].ToString()); for (int k = 1; k < ls.Data.Columns.Count; k++) { try { listView.Items[i - ls.Current].SubItems.Add(ls.Data.Rows[i][k].ToString()); } catch { } } if (!res) { res = true; } } })); } else { listView.Items.Clear(); for (int i = ls.Current; i < (ls.Current + screenSize) && i < ls.Data.Rows.Count; i++) { listView.Items.Add(ls.Data.Rows[i][0].ToString()); for (int k = 1; k < ls.Data.Columns.Count; k++) { try { listView.Items[i - ls.Current].SubItems.Add(ls.Data.Rows[i][k].ToString()); } catch { } } if (!res) { res = true; } } } return(res); }
public override bool LoadData() { lst = ListForShow.GetAllLists(cn, projNum); currentList = 0; return(lst.Count > 0); }
private bool RefreshListView(ListForShow ls) { if (ls == null) { return(false); } if (ls.Current == 0) { try { if (this.ParentF != null) { if (this.ParentF.InvokeRequired) { this.ParentF.Invoke(new EventHandler(delegate { this.ParentF.Text = ls.Group + " " + ls.Round + " " + ls.Style; })); } else { this.ParentF.Text = ls.Group + " " + ls.Round + " " + ls.Style; } } } catch { } var lstp = ls.GetListType(cn); if (lstp != currentListConfig || refreshCount < 2) { listView.Items.Clear(); listView.Columns.Clear(); foreach (DataColumn dc in ls.Data.Columns) { listView.Columns.Add(dc.ColumnName, 40, HorizontalAlignment.Center); } listView.Columns[0].Width = 45; listView.Columns[1].Width = 240; listView.Columns[1].TextAlign = HorizontalAlignment.Left; listView.Columns[2].Width = 57; listView.Columns[3].Width = 70; listView.Columns[4].Width = 200; listView.Columns[ls.Data.Columns.Count - 1].Width = 50; switch (lstp) { case ListForShow.ListType.BOULDER: break; case ListForShow.ListType.LEAD: listView.Columns[5].Width = 74; break; case ListForShow.ListType.FLASH: listView.Columns[5].Width = 74; for (int i = 6; i < ls.Data.Columns.Count - 1; i++) { listView.Columns[i].Width = 74; } break; case ListForShow.ListType.SPEED: for (int ii = 5; ii < ls.Data.Columns.Count - 1; ii++) { listView.Columns[ii].Width = 100; } break; case ListForShow.ListType.SPEED_2: goto case ListForShow.ListType.SPEED; default: return(false); } listView.View = View.Details; currentListConfig = lstp; if (refreshCount < 2) { refreshCount++; } } } RefreshCurrentScreen(); return(true); }