public void OnMouseMove(object sender, MouseEventArgs e) { if (ButtonState.IsDrag) { if (ButtonDragMove != null) { ButtonDragMove(sender, e); } } else if (!ButtonState.IsInactive && !ButtonState.IsSingleClick) { if (ShouldIgnoreMovement(e)) { return; } ButtonState.SetDrag(); _timerDoubleClick.Stop(); _timerHeldClick.Stop(); if (ButtonDragStart != null) { MouseManagerEventArgs eventArgs = ButtonState.BuildEventArgs(); eventArgs.End = eventArgs.Start; ButtonDragStart(this, eventArgs); } } }
private void OnDoubleClick() { _timerHeldClick.Stop(); if (ButtonDoubleClick != null) { ButtonDoubleClick(this, ButtonState.BuildEventArgs()); } ButtonState.Reset(); }
private void OnHeldClick(object sender, EventArgs e) { _timerHeldClick.Stop(); if (ButtonState.IsMouseDown || ButtonState.IsSingleClick) { if (ButtonHeldClick != null) { MouseManagerEventArgs eventArgs = ButtonState.BuildEventArgs(); eventArgs.End = eventArgs.Start; ButtonHeldClick(this, eventArgs); } } ButtonState.Reset(); }
public void OnMouseLeave(object sender, MouseEventArgs e) { if (!ButtonState.IsDrag && !ButtonState.IsInactive && !ButtonState.IsSingleClick) { ButtonState.SetDrag(); _timerDoubleClick.Stop(); _timerHeldClick.Stop(); if (ButtonDragStart != null) { MouseManagerEventArgs eventArgs = ButtonState.BuildEventArgs(); eventArgs.End = eventArgs.Start; ButtonDragStart(this, eventArgs); } } }
public void OnMouseButtonUp(object sender, MouseButtonEventArgs e) { e.Handled = true; ButtonState.End.PositionInformation = e; ButtonState.End.EventOrigin = sender; if (ButtonState.IsMouseDown) { ButtonState.SetSingleClick(); } else if (ButtonState.IsSingleClick) { ButtonState.SetDoubleClick(); } else if (ButtonState.IsDrag) { _timerDoubleClick.Stop(); _timerHeldClick.Stop(); if (ButtonDragReleased != null) { ButtonDragReleased(this, ButtonState.BuildEventArgs()); } ButtonState.Reset(); } else if (ButtonState.IsInactive) { _timerDoubleClick.Stop(); _timerHeldClick.Stop(); if (ButtonDragReleased != null) { MouseManagerEventArgs eventArgs = ButtonState.BuildEventArgs(); eventArgs.Start = eventArgs.End; ButtonDragReleased(this, eventArgs); } ButtonState.Reset(); } }