示例#1
0
        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;
        }
示例#2
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();
        }