Ejemplo n.º 1
0
        private void InitKeyConfigUI()
        {
            _keyConfigList.Items.Clear();

            //列挙してソート
            TypedHashtable <ICommandCategory, List <IGeneralCommand> > category_list = new TypedHashtable <ICommandCategory, List <IGeneralCommand> >();

            foreach (IGeneralCommand cmd in _keybinds.Commands)
            {
                ICommandCategory cat = cmd.CommandCategory;
                if (cat != null && cat.IsKeybindCustomizable)
                {
                    if (category_list.Contains(cat))
                    {
                        category_list[cat].Add(cmd);
                    }
                    else
                    {
                        List <IGeneralCommand> l = new List <IGeneralCommand>();
                        l.Add(cmd);
                        category_list.Add(cat, l);
                    }
                }
            }

            ICollection result = PositionDesignationSorter.SortItems(category_list.Keys);

            foreach (ICommandCategory cat in result)
            {
                foreach (IGeneralCommand cmd in category_list[cat])
                {
                    ListViewItem li = new ListViewItem(cat.Name);
                    li = _keyConfigList.Items.Add(li);
                    li.SubItems.Add(cmd.Description);
                    li.SubItems.Add(FormatKey(_keybinds.GetKey(cmd)));
                    li.Tag = cmd;
                }
            }
        }