Beispiel #1
0
        private void OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            DateTime now = DateTime.Now;

            MouseClickHelper.MouseEventInfo @event = this.FindEvent(this._queuedMouseUpEvents, sender);
            if (@event != null)
            {
                @event.DateTime = now;
            }
            this.RemoveEvent(this._queuedMouseDownEvents, sender);
            this.AddEvent(this._queuedMouseDownEvents, sender, e);
        }
Beispiel #2
0
 private void OnMouseMove(object sender, MouseEventArgs e)
 {
     if (this.IsQueueEmpty)
     {
         return;
     }
     MouseClickHelper.MouseEventInfo @event = this.FindEvent(this._queuedMouseUpEvents, sender);
     if (@event == null || MouseClickHelper.MouseEventInfo.IsInProximity(e.GetPosition((IInputElement)(sender as UIElement)), @event.Position))
     {
         return;
     }
     this.FireSingleClick(@event);
 }
Beispiel #3
0
 private void FireSingleClick(MouseClickHelper.MouseEventInfo info)
 {
     this._queuedMouseUpEvents.Remove(info);
     MouseClickHelper.MouseEventInfo @event = this.FindEvent(this._queuedMouseDownEvents, info.Sender);
     if (@event == null)
     {
         return;
     }
     this._queuedMouseDownEvents.Remove(@event);
     if (!info.IsInProximity(@event) || this._singleClickAction == null)
     {
         return;
     }
     this._singleClickAction(info.Sender, info.Args);
 }
Beispiel #4
0
 private void OnMouseUp(object sender, MouseButtonEventArgs e)
 {
     MouseClickHelper.MouseEventInfo @event = this.FindEvent(this._queuedMouseUpEvents, sender);
     if (@event == null)
     {
         this.AddEvent(this._queuedMouseUpEvents, sender, e);
     }
     else
     {
         this.RemoveEvent(this._queuedMouseUpEvents, @event);
         this.RemoveEvent(this._queuedMouseDownEvents, sender);
         if (this._doubleClickAction == null)
         {
             return;
         }
         this._doubleClickAction(sender, e);
     }
 }
Beispiel #5
0
 public bool IsInProximity(MouseClickHelper.MouseEventInfo another)
 {
     return(MouseClickHelper.MouseEventInfo.IsInProximity(this.Position, another.Position));
 }
Beispiel #6
0
 private void RemoveEvent(List <MouseClickHelper.MouseEventInfo> queuedEvents, MouseClickHelper.MouseEventInfo prevEvent)
 {
     if (prevEvent == null)
     {
         return;
     }
     queuedEvents.Remove(prevEvent);
 }
Beispiel #7
0
 private void RemoveEvent(List <MouseClickHelper.MouseEventInfo> queuedEvents, object sender)
 {
     MouseClickHelper.MouseEventInfo @event = this.FindEvent(queuedEvents, sender);
     this.RemoveEvent(queuedEvents, @event);
 }