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; }
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 }
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; }
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); }
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)); }