public static TreeNode CimToNode(CimMethod method) { /* <!ELEMENT METHOD * (QUALIFIER*,(PARAMETER|PARAMETER.REFERENCE|PARAMETER.ARRAY|PARAMETER.REFARRAY)*)> * <!ATTLIST METHOD * %CIMName; * %CIMType; #IMPLIED * %ClassOrigin; * %Propagated;> * */ TreeNode root = new TreeNode(method.Name.ToString()); root.Nodes.Add(new TreeNode("Type - " + method.Type.ToString())); if (method.ClassOrigin != null) root.Nodes.Add(new TreeNode("ClassOrigin - " + method.ClassOrigin.ToString())); root.Nodes.Add(new TreeNode("Propagated - " + method.IsPropagated.ToString())); root.Nodes.Add(CimToNode(method.Qualifiers)); root.Nodes.Add(CimToNode(method.Parameters)); return root; }
public CimMethodForm(CimMethod displayMethod) { InitializeComponent(); //------------------------------------------------------ List<ListViewItem> list; DisplayMethod = displayMethod; this.Text = "CimMethod - " + DisplayMethod.Name.ToString(); #region Display Signature this.AddLabel(LabelType.Type); LastLabel.Text = DisplayMethod.Type.ToString(); this.IndentPx = LastLabel.Width; this.AddLabel(LabelType.Name); LastLabel.Text = DisplayMethod.ClassOrigin.ToString() + "." + DisplayMethod.Name.ToString(); LastLabel.Text += "("; foreach (CimParameter curParam in DisplayMethod.Parameters) { this.AddLabel(LabelType.Type); LastLabel.Text = curParam.Type.ToString(); this.AddLabel(LabelType.Name); LastLabel.Text = curParam.Name.ToString(); LastLabel.Text += ","; } LastLabel.Text = LastLabel.Text.TrimEnd(',', ' '); this.AddLabel(LabelType.Other); LastLabel.Text = ")"; #endregion #region Display Description this.uxLbl_Description.Text = "Description:"; if (DisplayMethod.Qualifiers["Description"] != null) { string desc = DisplayMethod.Qualifiers["Description"].Values[0]; this.uxTxtBx_Description.Lines = desc.Split('\n'); this.uxTxtBx_Description.Select(0, 0); } #endregion #region Display Attributes list = new List<ListViewItem>(); list.Add(ListViewUtils.AttrToListViewItem("Name", DisplayMethod.Name.ToString())); list.Add(ListViewUtils.AttrToListViewItem("Type", DisplayMethod.Type.ToString())); list.Add(ListViewUtils.AttrToListViewItem("IsPropagated", DisplayMethod.IsPropagated.ToString())); #endregion #region Display Quals and Params list.AddRange(ListViewUtils.ToList(DisplayMethod.Qualifiers)); list.AddRange(ListViewUtils.ToList(DisplayMethod.Parameters)); #endregion uxLstView_Items.Items.AddRange(list.ToArray()); colName.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); colType.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); this.AlignSignatureLabels(null, null); }