Exemplo n.º 1
0
        /// <summary>
        /// Inserts the list of graphs and their series to the TreeView.
        /// </summary>
        private void GetGraphsFromRun()
        {
            GraphView.Nodes.Clear();
            GraphView.BeginUpdate();

            //reference for easy access
            GraphsList graphs = _currentRun.Graphs;

            try
            {
                //iterate through all graphs
                for (int i = 0; i < graphs.Count; i++)
                {
                    //add a graph to TreeVeiw
                    GraphView.Nodes.Add(graphs[i].Name.Name, graphs[i].Name.Name, 1);
                    try
                    {
                        //if there are no series in graph - mark it as an empty
                        if (graphs[i].Series.Count == 0)
                        {
                            GraphView.Nodes[i].ImageIndex = _EmptyGraph;
                        }

                        //iterate through all series of current graph
                        foreach (Series s in graphs[i].Series)
                        {
                            //add series as a child of a graph
                            GraphView.Nodes[i].Nodes.Add(s.Name);
                        }
                    }
                    catch (Exception ex)
                    {
                        //mark problematic graph as empty
                        GraphView.Nodes[i].ImageIndex = _EmptyGraph;
                        MessageBox.Show(ex.Message);
                    }
                }
            }
            finally
            {
                GraphView.EndUpdate();
            }

            //uncheck show all graphs menu item
            showAllGraphsToolStripMenuItem.Checked = false;
        }