private void HandleMouseClick(object sender, MouseEventArgs mouseEventArgs) { if (_HighlightedField == null) { return; } var hit = HitTest(mouseEventArgs.Location); if (!hit.HasValue) { return; } var highlighted = _HighlightedField; FieldCoords selected = null; if (hit.Value.Item2.IsColor) { var clickedColor = ((FieldState.Color)hit.Value.Item2).Item; if (clickedColor.Equals(CurrentPlayer)) { selected = hit.Value.Item1; } } else { if (_SelectedField != null) { if (CheckValidMove(_SelectedField, hit.Value.Item1)) { selected = null; highlighted = null; MoveRequested.Raise(this, Tuple.Create(_SelectedField, hit.Value.Item1)); } else { selected = _SelectedField; } } } using (var canvas = Graphics.FromImage(_MainPictureBox.Image)) { ClearMarks(canvas); SetMarks(canvas, highlighted, selected); } _MainPictureBox.Invalidate(); }
private void RequestMoveTo(IFavouriteDirectoryViewModel target) => MoveRequested.Raise(this, new FavouriteDirectoryMoveRequestedEventArgs(target));