private async void this_Load(object sender, EventArgs e) { m_propListTreeView.BeginUpdate(); m_propListTreeView.Nodes.Clear(); var trunk = m_propListTreeView.Nodes.Add(_value.ToString()); trunk.ImageKey = "object"; if (_value.Tag == KiTag.Ref) { await PopulateTreeNode(trunk, (KiRef)_value); } trunk.Expand(); m_propListTreeView.EndUpdate(); }
public ObjectViewer(Inferior inferior, string objectName, KiAtom value) { InitializeComponent(); StyleManager.AutoStyle(this); m_nameTextBox.Text = string.Format("eval('{0}') = {1};", objectName.Replace(@"\", @"\\").Replace("'", @"\'").Replace("\n", @"\n").Replace("\r", @"\r"), value.ToString()); TreeIconImageList.Images.Add("object", Resources.StackIcon); TreeIconImageList.Images.Add("prop", Resources.VisibleIcon); TreeIconImageList.Images.Add("hiddenProp", Resources.InvisibleIcon); _inferior = inferior; _value = value; }
private async Task PopulateTreeNode(TreeNode node, KiRef handle) { m_propListTreeView.BeginUpdate(); var props = await _inferior.InspectObject(handle, 0, int.MaxValue); foreach (var key in props.Keys) { if (props[key].Flags.HasFlag(PropFlags.Accessor)) { KiAtom getter = props[key].Getter; KiAtom setter = props[key].Setter; var nodeText = string.Format("{0} = get: {1}, set: {2}", key, getter.ToString(), setter.ToString()); var valueNode = node.Nodes.Add(nodeText); valueNode.ImageKey = "prop"; valueNode.SelectedImageKey = valueNode.ImageKey; valueNode.Tag = props[key]; } else { KiAtom value = props[key].Value; var nodeText = string.Format("{0} = {1}", key, value.ToString()); var valueNode = node.Nodes.Add(nodeText); valueNode.ImageKey = "prop"; valueNode.SelectedImageKey = valueNode.ImageKey; valueNode.Tag = props[key]; if (value.Tag == KiTag.Ref) { valueNode.Nodes.Add(""); } } } if (node.Nodes.Count > 0 && node.Nodes[0].Text == "") { node.Nodes.RemoveAt(0); } m_propListTreeView.EndUpdate(); }