Beispiel #1
0
        private void OkButtonClick(object sender, EventArgs e)
        {
            if (!IsValid())
            {
                MessageBox.Show("No name specified!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Key = new KeyData
            {
                Name = NameBox.Text,
                Type = TypeBox.Text
            };

            CloseForm();
        }
Beispiel #2
0
        private void AddKey(KeyData data)
        {
            if (ItemManager.KeyData.ContainsKey(data.Name))
            {
                DialogResult result = MessageBox.Show(data.Name + " already exists. Overwrite it?", "Key Exists",
                                                      MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result != DialogResult.Yes)
                    return;

                ItemManager.KeyData[data.Name] = data;
                LoadKeys();
                return;
            }

            ItemManager.KeyData.Add(data.Name, data);
            DetailList.Items.Add(data);
        }
Beispiel #3
0
 private void FormCancelButtonClick(object sender, EventArgs e)
 {
     Key = null;
     CloseForm();
 }