コード例 #1
0
        void HandleKeyChangeClick(object sender, EventArgs e)
        {
            KeyEditForm keyEdit = new KeyEditForm(this.currentKey, FormIcon);

            if (keyEdit.ShowDialog() == DialogResult.OK)
            {
                //NewMessage.Show (keyEdit.keyOut.Key.ToString ()+ keyEdit.keyOut.ModifyingKey.ToString());
                IsModified = true;
                keyOut     = keyEdit.keyOut;

                BuildKeyString(keyOut);
            }
            // do this regardless, we are just updating interface, not data
            if (AfterKeyEdit != null)
            {
                // we just redraw the CURRENT one
                AfterKeyEdit(keyOut.GetGUID());
            }
        }
コード例 #2
0
ファイル: KeyData.cs プロジェクト: BrentKnowles/YourOtherMind
        public int CompareTo(object obj)
        {
            KeyData u = (KeyData)obj;

            return(this.Label.CompareTo(u.Label));
        }
コード例 #3
0
        public KeyEditForm(KeyData keyIn, Icon formIcon)
        {
            this.Icon         = formIcon;
            this.FormClosing += HandleFormClosing;

            Label labelModifier = new Label();

            labelModifier.Text = Loc.Instance.GetString("Modifier");
            labelModifier.Dock = DockStyle.Top;

            Label labelKey = new Label();

            labelKey.Text = Loc.Instance.GetString("Key");
            labelKey.Dock = DockStyle.Top;

            keyModifier = new ComboBox();
            keyModifier.DropDownStyle = ComboBoxStyle.DropDownList;
            keyModifier.Dock          = DockStyle.Top;



            keyKey = new ComboBox();


            keyKey.Dock = DockStyle.Top;

            keyKey.DropDownStyle = ComboBoxStyle.DropDownList;



            Array arrKeys = Enum.GetValues(typeof(Keys));

            foreach (object key in arrKeys)
            {
                keyModifier.Items.Add(key.ToString());
                keyKey.Items.Add(key.ToString());
            }
            keyModifier.Text = keyIn.ModifyingKey.ToString();
            keyKey.Text      = keyIn.Key.ToString();

            Panel bottom = new Panel();

            bottom.Height = 40;
            bottom.Dock   = DockStyle.Bottom;

            Button OK = new Button();

            OK.Text = Loc.Instance.GetString("OK");

            OK.Dock         = DockStyle.Right;
            OK.DialogResult = DialogResult.OK;


            Button Cancel = new Button();

            Cancel.Text         = Loc.Instance.GetString("Cancel");
            Cancel.Padding      = new System.Windows.Forms.Padding(10);
            Cancel.DialogResult = DialogResult.Cancel;
            Cancel.Dock         = DockStyle.Right;

            bottom.Controls.Add(OK);
            bottom.Controls.Add(Cancel);


            this.Controls.Add(bottom);


            this.Controls.Add(keyKey);
            this.Controls.Add(labelKey);

            this.Controls.Add(keyModifier);
            this.Controls.Add(labelModifier);


            keyOut = keyIn;
        }
コード例 #4
0
 void BuildKeyString(KeyData keyToBuild)
 {
     modifier.Text = Loc.Instance.GetStringFmt("{0} ({1} + {2})", keyToBuild.Label, keyToBuild.ModifyingKey.ToString(), keyToBuild.Key.ToString());
 }