Exemplo n.º 1
0
        public void OK_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 -= Form_Close;
            this.Close();
        }
Exemplo n.º 2
0
        public void AddKey(KeyData key)
        {
            if (FormDetails.itemDataManager.KeyData.ContainsKey(key.Name))
            {
                DialogResult result = MessageBox.Show(key.Name + " already exists, do you want to overwrite?",
                    "Existing Key", MessageBoxButtons.YesNo);

                if (result == DialogResult.No)
                {
                    return;
                }

                itemDataManager.KeyData[key.Name] = key;
                FillListBox();

                return;
            }

            itemDataManager.KeyData.Add(key.Name, key);
            lbDetails.Items.Add(key);
        }
Exemplo n.º 3
0
 public void Cancel_Click(object sender, EventArgs e)
 {
     key = null;
     this.FormClosing -= Form_Close;
     this.Close();
 }
Exemplo n.º 4
0
        private void AddKey(KeyData keyData)
        {
            if (FormDetails.ItemManager.KeyData.ContainsKey(keyData.Name))
            {
                DialogResult result = MessageBox.Show(
                    keyData.Name + " already exists. Overwrite it?",
                    "Existing key",
                    MessageBoxButtons.YesNo);

                if (result == DialogResult.No)
                    return;

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

            itemManager.KeyData.Add(keyData.Name, keyData);
            lbDetails.Items.Add(keyData);
        }
Exemplo n.º 5
0
 void btnCancel_Click(object sender, EventArgs e)
 {
     key = null;
     this.FormClosing -= FormKeyDetails_FormClosing;
     this.Close();
 }