Пример #1
0
        internal DTreeNode<DependencyGraphData> GetAssemblyGraph(TreeSelectionData selectedData)
        {
            string keyname = string.Empty;

            switch (selectedData.SelectionType)
            {
                case SelectionType.ASSEMBLY:
                    keyname = selectedData.AssemblyName;
                    break;
                case SelectionType.NAMESPACE:
                    keyname = selectedData.AssemblyName + "." + selectedData.NameSpace;
                    break;
                case SelectionType.TYPE:
                    keyname = selectedData.AssemblyName + "." + selectedData.NameSpace + "." + selectedData.TypeName;
                    break;
                default:
                    break;
            }

            if (!string.IsNullOrEmpty(keyname))
            {
                try
                {
                    return graphData[keyname];
                }
                catch (Exception ex)
                {
                    Logger.Current.Debug(">> Exception in getting keyname for graph Data:" + ex);
                }
            }


            return null;
        }
Пример #2
0
 public DTreeNode<DependencyGraphData> GetDependencyGraphData(TreeSelectionData selectedData)
 {
     return AssemblyData.GetAssemblyGraph(selectedData);
 }
Пример #3
0
 private void CreateDependencyGraph(TreeSelectionData selectedData)
 {
     RootGraphData = mainController.GetDependencyGraphData(selectedData);
     ArrangeDiagram();
 }
Пример #4
0
 private void resetFilterToolStripMenuItem_Click(object sender, EventArgs e)
 {
   SelectionType selectedType = this.DetermineSelectionType();
   if (selectedType != SelectionType.NONE)
   {
     var selectedData = new TreeSelectionData(tvController, selectedType);
     this.OnSequenceViewerTab(selectedData);
   }
 }
Пример #5
0
        private void OnAssemblyStatTab(TreeSelectionData selectedData)
        {
            Logger.Current.Debug("MainForm::OnAssemblyStatTab");
            // see which item in treeview is clicked
            Logger.Current.Debug(">> TreeView Clicked: Depth is:" + tvController.SelectedNode.Depth);

            CreateChart(selectedData);
        }
Пример #6
0
        // Call this method from the Form_Load method, passing your ZedGraphControl
        public void CreateChart(TreeSelectionData selectionData)
        {
            GraphPane myPane = zedGraph.GraphPane;
            myPane.CurveList = new CurveList();
            // Set the GraphPane title
            string selectedItem = tvController.SelectedNode.Value.Text;
            string selectedItemParent = tvController.SelectedNode.Parent.Value.Text;
            myPane.Title.Text = selectedItem;
            myPane.Title.FontSpec.IsItalic = true;
            myPane.Title.FontSpec.Size = 24f;
            myPane.Title.FontSpec.Family = "Times New Roman";

            // Fill the pane background with a color gradient
            myPane.Fill = new Fill(Color.White, Color.Goldenrod, 45.0f);
            // No fill for the chart background
            myPane.Chart.Fill.Type = FillType.None;

            // Set the legend to an arbitrary location
            myPane.Legend.Position = LegendPos.Float;
            myPane.Legend.Location = new Location(0.95f, 0.15f, CoordType.PaneFraction,
                                                  AlignH.Right, AlignV.Top);
            myPane.Legend.FontSpec.Size = 10f;
            myPane.Legend.IsHStack = false;
            myPane.Legend.IsVisible = false;

            switch (selectionData.SelectionType)
            {
                case SelectionType.ASSEMBLY:
                    foreach (
                        NamespaceData nsData in mainController.AssemblyParser.AssemblyData.AssemblyStats.NamespaceList)
                    {
                        if (nsData.AssemblyName.Equals(selectedItem))
                        {
                            myPane.AddPieSlice(nsData.TotalTypes, Color.Purple, Color.White, 45f, 0.2,
                                               nsData.NamespaceText);
                        }
                    }
                    break;
                case SelectionType.NAMESPACE:
                    foreach (TypeData tData in mainController.AssemblyParser.AssemblyData.AssemblyStats.TypeList)
                    {
                        if (tData.AssemblyName.Equals(selectedItemParent) && tData.NamespaceText.Equals(selectedItem))
                        {
                            myPane.AddPieSlice(tData.TotalMethods, Color.Turquoise, Color.White, 45f, 0.2,
                                               tData.TypeName);
                        }
                    }
                    break;
                default:
                    break;
            }

            // Sum up the pie values                                                               
            CurveList curves = myPane.CurveList;
            double total = 0;
            for (int x = 0; x < curves.Count; x++)
                total += ((PieItem) curves[x]).Value;

            // Calculate the Axis Scale Ranges
            zedGraph.AxisChange();
            zedGraph.Refresh();
        }
Пример #7
0
        private void OnDependencyGraphTab(TreeSelectionData selectedData)
        {
            Logger.Current.Debug("MainForm::OnDependencyGraphTab");

            // check the treeview item
            Logger.Current.Debug(">> TreeView Item Clicked: Depth is:" + tvController.SelectedNode.Depth);

            CreateDependencyGraph(selectedData);
        }
Пример #8
0
        private void OnSequenceViewerTab(TreeSelectionData selectedData)
        {
            if (!tvController.SelectedNode.HasChildren)
            {
                // if method
                if (tvController.SelectedNode.Value.Text.IndexOf('(') > 0)
                {
                    string methodName = selectedData.MethodName;
                    string typeName = selectedData.TypeName;
                    string nameSpace = selectedData.NameSpace;
                    string assemblyname = selectedData.AssemblyName;

                    labelMethodDescription.Text = methodName;
                    labelTypeName.Text = "Type:" + typeName;
                    labelSelectedAssembly.Text = "Assembly:" + assemblyname;

                    SequenceData data = mainController.GetSequenceData(methodName, typeName, nameSpace, assemblyname);
                    IRenderer renderer = new WPFRenderer();
                    renderer.Export(data);
                }
            }
        }
Пример #9
0
        private bool SelectedDataChanged(TreeSelectionData data)
        {
            if (oldSelectedData != null &&
                data.AssemblyName == oldSelectedData.AssemblyName &&
                data.NameSpace == oldSelectedData.NameSpace &&
                data.TypeName == oldSelectedData.TypeName &&
                data.MethodName == oldSelectedData.MethodName)
            {
                return false;
            }

            return true;
        }
Пример #10
0
        private void SelectTabHandler()
        {
            SelectionType selectedType = DetermineSelectionType();

            if (selectedType != SelectionType.NONE)
            {
                var selectedData = new TreeSelectionData(tvController, selectedType);

                if (!SelectedDataChanged(selectedData))
                {
                    return;
                }

                oldSelectedData = selectedData;

                switch (tabControl.SelectedIndex)
                {
                    case 0: // sequence diagram tab
                        OnSequenceViewerTab(selectedData);
                        break;
                    case 1: // assembly stats tab
                        OnAssemblyStatTab(selectedData);
                        break;
                    case 2:
                        OnDependencyGraphTab(selectedData);
                        break;
                    default:
                        break;
                }
            }
        }
Пример #11
0
 internal DTreeNode<DependencyGraphData> GetDependencyGraphData(TreeSelectionData selectedData)
 {
     return AssemblyParser.GetDependencyGraphData(selectedData);
 }