/// <summary>
 /// Returns true if there is an event that has the specified button pressed, or false if none exists
 /// </summary>
 public static bool HasEvent(this InputAggregator inputAggregator,
                             UISButton uisButton, bool firstTime = false)
 {
     return(inputAggregator.GetEvents <ButtonsPressedEvent>().
            FirstOrDefault(ev =>
     {
         bool value;
         if (ev.PressedButtons.TryGetValue(uisButton, out value))
         {
             return value == firstTime;
         }
         return false;
     }) != null);
 }
コード例 #2
0
 /// <summary>
 /// Gets all events of the specified type
 /// </summary>
 /// <returns>A list of <see cref="IInputEvent"/>s</returns>
 public static IEnumerable <GestureEvent> GetGestures(this InputAggregator inputAggregator,
                                                      GestureType gestureType, GestureSource gestureSource = GestureSource.Left)
 {
     return(inputAggregator.GetEvents <GestureEvent>().Where(
                ev => (ev.Gesture & gestureType) != 0 && ev.Source == gestureSource));
 }