Пример #1
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);
        }
Пример #2
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);
        }