Beispiel #1
0
        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();
        }