internal static void AddGesturesFromResourceStrings(string keyGestures, string displayStrings, InputGestureCollection gestures)
 {
     while (!string.IsNullOrEmpty(keyGestures))
     {
         string str;
         string str2;
         int    index = keyGestures.IndexOf(";", StringComparison.Ordinal);
         if (index >= 0)
         {
             str2        = keyGestures.Substring(0, index);
             keyGestures = keyGestures.Substring(index + 1);
         }
         else
         {
             str2        = keyGestures;
             keyGestures = string.Empty;
         }
         index = displayStrings.IndexOf(";", StringComparison.Ordinal);
         if (index >= 0)
         {
             str            = displayStrings.Substring(0, index);
             displayStrings = displayStrings.Substring(index + 1);
         }
         else
         {
             str            = displayStrings;
             displayStrings = string.Empty;
         }
         UnrestrictedKeyGesture inputGesture = CreateFromResourceStrings(str2, str);
         if (inputGesture != null)
         {
             gestures.Add(inputGesture);
         }
     }
 }
 public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
 {
     if (((destinationType == typeof(string)) && (context != null)) && (context.Instance != null))
     {
         UnrestrictedKeyGesture instance = context.Instance as UnrestrictedKeyGesture;
         if (instance != null)
         {
             return(ModifierKeysConverter.IsDefinedModifierKeys(instance.Modifiers) && IsDefinedKey(instance.Key));
         }
     }
     return(false);
 }
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     if (destinationType == typeof(string))
     {
         if (value == null)
         {
             return(string.Empty);
         }
         UnrestrictedKeyGesture gesture = value as UnrestrictedKeyGesture;
         if (gesture != null)
         {
             if (gesture.Key == Key.None)
             {
                 return(string.Empty);
             }
             string str  = "";
             string str2 = (string)keyConverter.ConvertTo(context, culture, gesture.Key, destinationType);
             if (str2 != string.Empty)
             {
                 str = str + (modifierKeysConverter.ConvertTo(context, culture, gesture.Modifiers, destinationType) as string);
                 if (str != string.Empty)
                 {
                     str = str + '+';
                 }
                 str = str + str2;
                 if (!string.IsNullOrEmpty(gesture.DisplayString))
                 {
                     str = str + ',' + gesture.DisplayString;
                 }
             }
             return(str);
         }
     }
     throw base.GetConvertToException(value, destinationType);
 }
        public override bool CanConvertToString(object value, IValueSerializerContext context)
        {
            UnrestrictedKeyGesture gesture = value as UnrestrictedKeyGesture;

            return(((gesture != null) && ModifierKeysConverter.IsDefinedModifierKeys(gesture.Modifiers)) && UnrestrictedKeyGestureConverter.IsDefinedKey(gesture.Key));
        }