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 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(); } }
public void OnMouseButtonDown(object sender, MouseButtonEventArgs e) { e.Handled = true; if (ButtonState.IsDrag) { _timerDoubleClick.Stop(); _timerHeldClick.Stop(); ButtonState.Reset(); } if (ButtonState.IsInactive) { _timerHeldClick.Start(); _timerDoubleClick.Start(); ButtonState.SetMouseDown(); } ButtonState.Start.PositionInformation = e; ButtonState.Start.EventOrigin = sender; }