private void LoadInitial( )
        {
            lv.Items.Clear();
            Array values = Enum.GetValues(typeof(ScriptEditorActions));

            foreach (ScriptEditorActions action in values)
            {
                ListViewItem item = lv.Items.Add(action.ToString());
                item.SubItems.Add(ScriptEditorShortcutKeysProvider.ShortcutKeysAsStringFromAction(action));
                item.Tag = ScriptEditorShortcutKeysProvider.GetShortCut(action);
            }
        }
示例#2
0
        public static string ShortcutKeysAsStringFromAction(ScriptEditorActions action)
        {
            string result = String.Empty;

            Keys keys    = ScriptEditorShortcutKeysProvider.GetShortCut(action);
            Keys modKeys = Keys.Modifiers & keys;

            //Ctrl+Alt+Shift+M


            if ((Keys.Control & modKeys) == Keys.Control)
            {
                result += "Ctrl";
            }

            if ((Keys.Alt & modKeys) == Keys.Alt)
            {
                if (!String.IsNullOrEmpty(result))
                {
                    result += "+Alt";
                }
                else
                {
                    result += "Alt";
                }
            }

            if ((Keys.Shift & modKeys) == Keys.Shift)
            {
                if (!String.IsNullOrEmpty(result))
                {
                    result += "+Shift";
                }
                else
                {
                    result += "Shift";
                }
            }

            Keys key = Keys.KeyCode & keys;

            if (String.IsNullOrEmpty(result))
            {
                result += Enum.GetName(typeof(Keys), key);
            }
            else
            {
                result += "+" + Enum.GetName(typeof(Keys), key);
            }

            return(result);
        }