示例#1
0
        public ExpandableObject(object obj, ViewContext context)
        {
            CurrentObject = obj;
            Context       = context;
            ExpandedView  = new CachedView(() => new TypeInspector(obj, new ViewContext {
                Mode = ViewMode.Expanded
            }));
            CollapsedView = new CachedView(() => new TypeInspector(obj, new ViewContext {
                Mode = ViewMode.Collapsed
            }));

            var views             = new Container("viewModes");
            var typeViewSelection = new TypeViewSelection(obj, context);

            context.OnTypeSwitch += OnTypeSwitch;
            views.Add(typeViewSelection);

            Content = new ExtendedExpandable();
            Content.Tools.Add(views);
            Content.Label = new TypeNameView(CurrentObject);
            Content.OnExpandStateChanged += expanded => Refresh();
            Add(Content);

            Refresh();
        }
        public ExpandedClassType(object obj)
        {
            if (obj.GetType().GetInterfaces().Any())
            {
                Add(new ExtendedExpandable("Interfaces", new ExpandedInterfaceGroup(obj), expanded: false, labelClassNames: "expandedClassLabel"));
            }

            var properties = new ExtendedExpandable("Properties", new ExpandedPropertyGroup(obj), expanded: true, labelClassNames: "expandedClassLabel");

            Add(properties);

            if (obj.GetType().GetMethods().Any())
            {
                Add(new ExtendedExpandable("Methods", new ExpandedMethodGroup(obj), labelClassNames: "expandedClassLabel"));
            }
        }
        public ClassView(object obj, ViewContext context)
        {
            var viewFull = new Label();

            viewFull.AddClasses("icon node1 viewFull");
            var views = new Container("viewModes");

            Content = new ExtendedExpandable();
            Content.Tools.Add(views);

            Add(Content);

            PinnedItem      = new Span();
            PinnedItem.name = "pinned-symbol";
            PinnedItem.RegisterCallback <TooltipEvent>(e => {
                e.rect    = PinnedItem.worldBound;
                e.tooltip = string.Format("Use {0} to refer to this element", PinnedSymbol);
                e.StopImmediatePropagation();
            });

            SetObject(obj, context);

            Content.OnExpandStateChanged += OnExpandState;
        }