예제 #1
0
        public void LoadBindings(List <Hotkey> binds)
        {
            if (binds == null)
            {
                return;
            }

            m_selectedItem = null;
            int c = panel1.Controls.Count;

            for (int i = 0; i < c; i++)
            {
                Control ct = panel1.Controls[0];
                panel1.Controls.RemoveAt(0);
                ct?.Dispose();
            }

            foreach (Hotkey kb in binds)
            {
                KeyRebind krb = new KeyRebind();
                krb.Function = kb.Function;
                krb.KeyBind  = new Misc.Hotkey(kb.Keys);
                AddRebind(krb);
                krb.UpdateText();
            }
        }
예제 #2
0
        public void AddRebind()
        {
            KeyRebind krb = new KeyRebind();

            krb.SelectionChanged += Krb_SelectionChanged;
            krb.Dock              = DockStyle.Top;
            panel1.Controls.Add(krb);
        }
예제 #3
0
        public void RemoveRebind()
        {
            if (SelectedItem == null)
            {
                return;
            }

            panel1.Controls.Remove(SelectedItem);
            m_selectedItem?.Dispose();
            m_selectedItem = null;
        }
예제 #4
0
        private void Krb_SelectionChanged(object sender, bool IsSelected)
        {
            if (!IsSelected)
            {
                return;
            }

            if (m_selectedItem != null)
            {
                m_selectedItem.IsSelected = false;
            }
            m_selectedItem = sender as KeyRebind;
        }
예제 #5
0
 public void AddRebind(KeyRebind bind)
 {
     bind.SelectionChanged += Krb_SelectionChanged;
     bind.Dock              = DockStyle.Top;
     panel1.Controls.Add(bind);
 }