Exemple #1
0
        /// <inheritdoc />
        /// <summary>
        /// Determines whether the specified object can be converted into a <see cref="T:System.String" />.
        /// </summary>
        /// <param name="value">The object to evaluate for conversion.</param>
        /// <param name="context">Context information that is used for conversion.</param>
        /// <returns>
        /// <see langword="true" /> if the <paramref name="value" /> can be converted into a
        /// <see cref="T:System.String" />; otherwise, <see langword="false" />.
        /// </returns>
        public override bool CanConvertToString(object value, IValueSerializerContext context)
        {
            var gesture = value as MultiKeyGesture;

            return(gesture != null &&
                   ModifierKeysConverter.IsDefinedModifierKeys(gesture.Modifiers) &&
                   MultiKeyGesture.IsDefinedKey(gesture.Key));
        }
Exemple #2
0
 /// <summary>
 /// Gets a list of the containing sequences even if the <see cref="IsRealMultiKeyGesture"/> is set to false;
 /// </summary>
 /// <param name="gesture">The gesture.</param>
 /// <returns>All <see cref="KeySequence"/>s found</returns>
 public static IList <KeySequence> GetKeySequences(MultiKeyGesture gesture)
 {
     if (gesture.IsRealMultiKeyGesture)
     {
         return(gesture.GestureCollection);
     }
     if (gesture.Key == Key.None)
     {
         return(new List <KeySequence>());
     }
     return(new List <KeySequence> {
         new KeySequence(gesture.Modifiers, gesture.Key)
     });
 }
Exemple #3
0
 protected bool Equals(MultiKeyGesture other)
 {
     if (IsRealMultiKeyGesture && other.IsRealMultiKeyGesture)
     {
         if (GestureCollection.SequenceEqual(other.GestureCollection))
         {
             return(true);
         }
         return(false);
     }
     if (!other.IsRealMultiKeyGesture && !IsRealMultiKeyGesture)
     {
         return(Key == other.Key && Modifiers == other.Modifiers);
     }
     return(false);
 }
Exemple #4
0
 public GestureScopeMapping(GestureScope scope, MultiKeyGesture keyGesture)
 {
     Scope      = scope;
     KeyGesture = keyGesture;
 }