コード例 #1
0
ファイル: Highlighter.cs プロジェクト: pietervp/workbooks-1
        async void OnGlobalMouseDown(object sender, MouseEventExtArgs eventArgs)
        {
            // UIAutomation and the WpfTap debugger can cause
            // a native exception if we try to hide the
            // overlayWindow inside the event handler
            // while using the Visual Studio wpf
            // debugger so we Yield to avoid the problem.
            await Task.Yield();

            eventArgs.Handled     = true;
            mouseListener.Enabled = false;

            HighlightEnded?.Invoke(this, EventArgs.Empty);

            overlayWindow?.Hide();

            try {
                // Since everything's async, it's possible for the move handler's HighlightView call
                // to hit after this, causing the view to stay highlighted. So we cancel.
                CancelHighlightOnMove();
                await HighlightView(ToPoint (eventArgs.Location), andSelect : true, hierarchyKind : hierarchyKind);
            } catch (Exception e) {
                Log.Error(TAG, e);
            }
        }
コード例 #2
0
        async void MouseMonitor_MouseUp(CGPoint point)
        {
            mouseMonitor.Dispose();
            mouseMonitor = null;

            HighlightEnded?.Invoke(this, EventArgs.Empty);

            try {
                // Since everything's async, it's possible for the move handler's HighlightView call
                // to hit after this, causing the view to stay highlighted. So we cancel.
                CancelHighlightOnMove();
                await HighlightView(point, andSelect : true);
            } catch (Exception e) {
                Log.Error(TAG, e);
            }
        }