private void OnClick(MouseButtons button) { switch (button) { case MouseButtons.Left: IconClicked.Invoke(this, new EventArgs()); break; case MouseButtons.Right: MenuOpening.Invoke(this, new EventArgs()); break; } }
private void OnClick(MouseButtons button) { switch (button) { case MouseButtons.Left: if (Target != null && Target is Popup PopupTarget && !PopupTarget.IsOpen) { // We rely on time to avoid a flickering popup. if ((DateTime.UtcNow - LastClosedTime).TotalSeconds >= 1.0) { PopupTarget.IsOpen = true; } else { LastClosedTime = DateTime.MinValue; } } break; case MouseButtons.Right: MenuOpening?.Invoke(this, new EventArgs()); break; } }