Beispiel #1
0
        public static void SetShortCut(ScriptEditorActions action, Keys keys)
        {
            FieldInfo fi = typeof(ScriptEditorShortcutKeysProvider).GetField(Enum.GetName(action.GetType(), action));

            if (fi == null)
            {
                throw new InvalidOperationException(String.Format("Field \"{0}\" is not defined in ScriptEditorShortcutKeysProvider class", Enum.GetName(action.GetType(), action)));
            }
            fi.SetValue(null, keys);
        }
Beispiel #2
0
        public static Keys GetDefaultShortCut(ScriptEditorActions action)
        {
            PropertyInfo pi = typeof(ScriptEditorShortcutKeysProvider).GetProperty("Def" + Enum.GetName(action.GetType(), action));

            if (pi == null)
            {
                throw new InvalidOperationException(String.Format("Property \"{0}\" is not defined in ScriptEditorShortcutKeysProvider class", "Def" + Enum.GetName(action.GetType(), action)));
            }
            return((Keys)pi.GetValue(null, null));
        }