예제 #1
0
        void btnOK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbName.Text))
            {
                MessageBox.Show("You must enter a name for the item.");
                return;
            }

            key = new KeyData();
            key.Name = tbName.Text;
            key.Type = tbType.Text;

            this.FormClosing -= FormKeyDetails_FormClosing;
            this.Close();
        }
예제 #2
0
        private void AddKey(KeyData keyData)
        {
            if (FormDetails.ItemDataManager.KeyData.ContainsKey(keyData.Name))
            {
                DialogResult result = MessageBox.Show(
                    keyData.Name + " already exists. Overwrite it?",
                    "Existing key",
                    MessageBoxButtons.YesNo);

                if (result == DialogResult.No)
                    return;

                ItemDataManager.KeyData[keyData.Name] = keyData;
                FillListBox();
                return;
            }

            ItemDataManager.KeyData.Add(keyData.Name, keyData);
            lbDetails.Items.Add(keyData);
        }
예제 #3
0
 void btnCancel_Click(object sender, EventArgs e)
 {
     key = null;
     this.FormClosing -= FormKeyDetails_FormClosing;
     this.Close();
 }