// Internal abstraction is used by the Unit Tests
        internal async Task InternalPointerReleasedAsync(uint pointerId, Point position)
        {
            if (pointerId == _pointerId)
            {
                if (_appScreenshot == null)
                {
                    await UpdateAppScreenshotAsync();
                }

                UpdateEyedropper(position);
                _pointerId = null;
                if (_taskSource != null && !_taskSource.Task.IsCanceled)
                {
                    _taskSource.TrySetResult(Color);
                }

                PickCompleted?.Invoke(this, EventArgs.Empty);
            }
        }
        internal void InternalMouseUp(InputDevice inputDevice, Point position)
        {
            if (inputDevice == _inputDevice)
            {
                if (_appScreenshot == null)
                {
                    UpdateAppScreenshot();
                }

                UpdateEyedropper(position);
                _inputDevice = null;
                if (_taskSource != null && !_taskSource.Task.IsCanceled)
                {
                    _taskSource.TrySetResult(Color);
                }

                PickCompleted?.Invoke(this, EventArgs.Empty);
            }
        }
        private async void TargetGrid_PointerReleased(object sender, PointerRoutedEventArgs e)
        {
            var pointer = e.Pointer;

            if (pointer.PointerId == _pointerId)
            {
                var point = e.GetCurrentPoint(_rootGrid);
                if (_appScreenshot == null)
                {
                    await UpdateAppScreenshotAsync();
                }

                UpdateEyedropper(point.Position);
                PickCompleted?.Invoke(this, EventArgs.Empty);
                _pointerId = null;
                if (!_taskSource.Task.IsCanceled)
                {
                    _taskSource.SetResult(Color);
                }
            }
        }
 private void Eyedropper_PickCompleted(Eyedropper sender, EventArgs args)
 {
     EyedropperEnabled = false;
     PickCompleted?.Invoke(this, args);
 }
Beispiel #5
0
 protected virtual void OnPickCompleted(EventArgs e)
 {
     PickCompleted?.Invoke(this, e);
 }