public void AddTabPage(SeriesDataList.Item selectedItem) { if (selectedItem.Type == SeriesDataList.Type.Series) { string key = "SERIES " + data.SeriesVariables[selectedItem.ListIndex].VariableName; if (this.variableViewCollection.TabPages.ContainsKey(key)) { this.variableViewCollection.SelectedIndex = this.variableViewCollection.TabPages.IndexOfKey(key); } else { VariableTabPage seriesTabPage = new VariableTabPage(); seriesTabPage.SetData(data.SeriesVariables[selectedItem.ListIndex], data); seriesTabPage.ShowDataGrid(); this.variableViewCollection.TabPages.Add(seriesTabPage); this.variableViewCollection.SelectedIndex = this.variableViewCollection.TabPages.Count - 1; } } else if (selectedItem.Type == SeriesDataList.Type.Group) { string key = "GROUP " + data.SeriesGroups[selectedItem.ListIndex].GroupName; if (this.variableViewCollection.TabPages.ContainsKey(key)) { this.variableViewCollection.SelectedIndex = this.variableViewCollection.TabPages.IndexOfKey(key); } else { GroupTabPage groupTabPage = new GroupTabPage(); groupTabPage.SetData(data.SeriesGroups[selectedItem.ListIndex], data); groupTabPage.ShowDataGrid(); this.variableViewCollection.TabPages.Add(groupTabPage); this.variableViewCollection.SelectedIndex = this.variableViewCollection.TabPages.Count - 1; } } }
public void AddTabPage(string key, int index) { string[] temp = key.Split(' '); if (temp[0] == "SERIES") { VariableTabPage seriesTabPage = new VariableTabPage(); int listIndex = VariableFinder.FindVariableIndex(data.SeriesVariables, temp[1]); seriesTabPage.SetData(data.SeriesVariables[listIndex], data); seriesTabPage.ShowDataGrid(); this.variableViewCollection.TabPages.Insert(index, seriesTabPage); this.variableViewCollection.SelectedIndex = this.variableViewCollection.TabPages.Count - 1; } else if (temp[0] == "GROUP") { GroupTabPage groupTabPage = new GroupTabPage(); int listIndex = GroupFinder.FindGroupIndex(data.SeriesGroups, temp[1]); groupTabPage.SetData(data.SeriesGroups[listIndex], data); groupTabPage.ShowDataGrid(); this.variableViewCollection.TabPages.Insert(index, groupTabPage); this.variableViewCollection.SelectedIndex = this.variableViewCollection.TabPages.Count - 1; } else if (temp[0] == "STOCK") { StockTabPage stockTabPage = new StockTabPage(); int listIndex = StockFinder.FindStockIndex(data.SeriesStocks, temp[1]); stockTabPage.SetData(data.SeriesStocks[listIndex], data); stockTabPage.ShowDataGrid(); this.variableViewCollection.TabPages.Insert(index, stockTabPage); this.variableViewCollection.SelectedIndex = this.variableViewCollection.TabPages.Count - 1; } }
public void AddTabPage(string key, int index) { string[] temp = key.Split(' '); if (temp[0] == "SERIES") { VariableTabPage seriesTabPage = new VariableTabPage(); int listIndex = VariableFinder.FindVariableIndex(data.SeriesVariables, temp[1]); seriesTabPage.SetData(data.SeriesVariables[listIndex], data); seriesTabPage.ShowDataGrid(); this.variableViewCollection.TabPages.Insert(index, seriesTabPage); this.variableViewCollection.SelectedIndex = this.variableViewCollection.TabPages.Count - 1; } else if (temp[0] == "GROUP") { GroupTabPage groupTabPage = new GroupTabPage(); int listIndex = GroupFinder.FindGroupIndex(data.SeriesGroups, temp[1]); groupTabPage.SetData(data.SeriesGroups[listIndex], data); groupTabPage.ShowDataGrid(); this.variableViewCollection.TabPages.Insert(index, groupTabPage); this.variableViewCollection.SelectedIndex = this.variableViewCollection.TabPages.Count - 1; } }