示例#1
0
 public EventOwnerTreeNode(Type type, IEnumerable <RoutedEvent> events, EventsPageViewModel vm)
     : base(null, type.Name)
 {
     Children = new AvaloniaList <EventTreeNodeBase>(events.OrderBy(e => e.Name)
                                                     .Select(e => new EventTreeNode(this, e, vm)));
     IsExpanded = true;
 }
示例#2
0
        public MainViewModel(AvaloniaObject root)
        {
            _root        = root;
            _logicalTree = new TreePageViewModel(this, LogicalTreeNode.Create(root));
            _visualTree  = new TreePageViewModel(this, VisualTreeNode.Create(root));
            _events      = new EventsPageViewModel(this);

            UpdateFocusedControl();

            if (KeyboardDevice.Instance is not null)
            {
                KeyboardDevice.Instance.PropertyChanged += KeyboardPropertyChanged;
            }
            SelectedTab = 0;
            if (root is TopLevel topLevel)
            {
                _pointerOverSubscription = topLevel.GetObservable(TopLevel.PointerOverElementProperty)
                                           .Subscribe(x => PointerOverElement = x);
            }
            else
            {
#nullable disable
                _pointerOverSubscription = InputManager.Instance.PreProcess
                                           .OfType <Input.Raw.RawPointerEventArgs>()
                                           .Subscribe(e =>
                {
                    PointerOverRoot    = e.Root;
                    PointerOverElement = e.Root.GetInputElementsAt(e.Position).FirstOrDefault();
                });
#nullable restore
            }
示例#3
0
        public EventTreeNode(EventOwnerTreeNode parent, RoutedEvent @event, EventsPageViewModel vm)
            : base(parent, @event.Name)
        {
            Contract.Requires <ArgumentNullException>(@event != null);
            Contract.Requires <ArgumentNullException>(vm != null);

            _event           = @event;
            _parentViewModel = vm;
        }
示例#4
0
        public MainViewModel(TopLevel root)
        {
            _root        = root;
            _logicalTree = new TreePageViewModel(this, LogicalTreeNode.Create(root));
            _visualTree  = new TreePageViewModel(this, VisualTreeNode.Create(root));
            _events      = new EventsPageViewModel(root);

            UpdateFocusedControl();
            KeyboardDevice.Instance.PropertyChanged += KeyboardPropertyChanged;
            SelectedTab = 0;
            _pointerOverSubscription = root.GetObservable(TopLevel.PointerOverElementProperty)
                                       .Subscribe(x => PointerOverElement = x?.GetType().Name);
            Console = new ConsoleViewModel(UpdateConsoleContext);
        }
示例#5
0
        public MainViewModel(IControl root)
        {
            _root        = root;
            _logicalTree = new TreePageViewModel(LogicalTreeNode.Create(root));
            _visualTree  = new TreePageViewModel(VisualTreeNode.Create(root));
            _events      = new EventsPageViewModel(root);

            UpdateFocusedControl();
            KeyboardDevice.Instance.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == nameof(KeyboardDevice.Instance.FocusedElement))
                {
                    UpdateFocusedControl();
                }
            };

            SelectedTab = 0;
            root.GetObservable(TopLevel.PointerOverElementProperty)
            .Subscribe(x => PointerOverElement = x?.GetType().Name);
            Console = new ConsoleViewModel(UpdateConsoleContext);
        }
 public EventTreeNode(EventOwnerTreeNode parent, RoutedEvent @event, EventsPageViewModel vm)
     : base(parent, @event.Name)
 {
     Event            = @event ?? throw new ArgumentNullException(nameof(@event));
     _parentViewModel = vm ?? throw new ArgumentNullException(nameof(vm));
 }