コード例 #1
0
ファイル: Highlighter.cs プロジェクト: pietervp/workbooks-1
        async Task HighlightView(
            Point screenPt,
            bool andSelect,
            string hierarchyKind,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            Point       devicePt;
            InspectView view = null;

            if (coordinateMapper != null && coordinateMapper.TryGetLocalCoordinate(screenPt, out devicePt))
            {
                view = await clientSession.Agent.Api.HighlightView <InspectView> (
                    devicePt.X,
                    devicePt.Y,
                    clear : true,
                    hierarchyKind : hierarchyKind,
                    cancellationToken : cancellationToken);
            }

            if (view == null)
            {
                highlightedView = null;
                overlayWindow.Clear();
                return;
            }

            // Don't clear or redraw anything. We are over the same view.
            if (highlightedView != null && view.Handle == highlightedView.Handle && !andSelect)
            {
                return;
            }

            highlightedView = view;
            overlayWindow.Clear();

            if (andSelect)
            {
                highlightedView = null;
                ViewSelected?.Invoke(this, new HighlightSelectionEventArgs {
                    SelectedView = view
                });
            }
            else
            {
                overlayWindow.HighlightRect(coordinateMapper.GetHostRect(new Rect {
                    X      = view.X,
                    Y      = view.Y,
                    Width  = view.Width,
                    Height = view.Height,
                }));
            }
        }
コード例 #2
0
        public override void MouseUp(NSEvent theEvent)
        {
            base.MouseUp(theEvent);

            if (isDragging)
            {
                return;
            }

            var inspectView = focusedNode?.InspectView;

            if (inspectView != null)
            {
                ViewSelected?.Invoke(inspectView);
            }
        }
コード例 #3
0
        async Task HighlightView(
            CGPoint screenPt,
            bool andSelect,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            CGPoint     devicePt = CGPoint.Empty;
            InspectView view     = null;

            var isValidLocalCoordinate = coordinateMapper != null &&
                                         coordinateMapper.TryGetLocalCoordinate(screenPt, out devicePt);

            view = await clientSession.Agent.Api.HighlightView <InspectView> (
                devicePt.X,
                devicePt.Y,
                clear : andSelect || !isValidLocalCoordinate,
                hierarchyKind : hierarchyKind,
                cancellationToken : cancellationToken);

            if (!isValidLocalCoordinate || view == null)
            {
                highlightedView = null;
                return;
            }

            // Don't clear or redraw anything. We are over the same view.
            if (highlightedView != null && view.Handle == highlightedView.Handle && !andSelect)
            {
                return;
            }

            highlightedView = view;

            if (andSelect)
            {
                highlightedView = null;
                ViewSelected?.Invoke(this, new HighlightSelectionEventArgs {
                    SelectedView = view
                });
            }
        }
コード例 #4
0
 internal void OnViewSelected(EnvironmentView view)
 {
     ViewSelected?.Invoke(this, new EnvironmentViewEventArgs(view));
 }