private void cmbSelectView_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.variableViewCollection.SelectedIndex >= 0)
            {
                if (this.variableViewCollection.SelectedTab.Name.Contains("SERIES "))
                {
                    VariableTabPage vtp = (VariableTabPage)this.variableViewCollection.SelectedTab;
                    switch (this.cmbSelectView.SelectedIndex)
                    {
                    case 0: vtp.ShowDataGrid(); break;

                    case 1: vtp.ShowGraph(); break;

                    case 2: vtp.ShowStatistics(); break;
                    }
                }
                else if (this.variableViewCollection.SelectedTab.Name.Contains("GROUP "))
                {
                    GroupTabPage gtp = (GroupTabPage)this.variableViewCollection.SelectedTab;
                    switch (this.cmbSelectView.SelectedIndex)
                    {
                    case 0: gtp.ShowDataGrid(); break;

                    case 1: gtp.ShowGraph(); break;
                    }
                }
            }
        }
 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;
     }
 }
 private void cmdStatistics_Click(object sender, EventArgs e)
 {
     this.cmdStatistics.BackgroundImage = zaitun.Properties.Resources.button_selected_view_pane2;
     if (this.variableViewCollection.SelectedTab.Name.Contains("SERIES "))
     {
         VariableTabPage vtp = (VariableTabPage)this.variableViewCollection.SelectedTab;
         vtp.ShowStatistics();
     }
 }
 private void cmdSpreadsheet_Click(object sender, EventArgs e)
 {
     this.cmdSpreadSheet.BackgroundImage = zaitun.Properties.Resources.button_selected_view_pane2;
     if (this.variableViewCollection.SelectedTab.Name.Contains("SERIES "))
     {
         VariableTabPage vtp = (VariableTabPage)this.variableViewCollection.SelectedTab;
         vtp.ShowDataGrid();
     }
     else if (this.variableViewCollection.SelectedTab.Name.Contains("GROUP "))
     {
         GroupTabPage gtp = (GroupTabPage)this.variableViewCollection.SelectedTab;
         gtp.ShowDataGrid();
     }
     else if (this.variableViewCollection.SelectedTab.Name.Contains("STOCK "))
     {
         StockTabPage stp = (StockTabPage)this.variableViewCollection.SelectedTab;
         stp.ShowDataGrid();
     }
 }
 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;
     }
 }