예제 #1
0
 private void addButton_Click(object sender, EventArgs e)
 {
     using (KeyValueDialog dialog = new KeyValueDialog(sprite.ext.Keys)) {
         if (dialog.ShowDialog(this) == DialogResult.OK) {
             listBox.Items.Add(dialog.KeyValuePair);
         }
     }
 }
예제 #2
0
 private void listBox_DoubleClick(object sender, EventArgs e)
 {
     if (listBox.SelectedIndex == -1) return;
     List<string> forbiddenKeys = new List<string>(sprite.ext.Keys);
     forbiddenKeys.Remove(((KeyValuePair<string, string>)listBox.SelectedItem).Key);
     using (KeyValueDialog dialog = new KeyValueDialog((KeyValuePair<string, string>)listBox.SelectedItem, forbiddenKeys)) {
         if (dialog.ShowDialog(this) == DialogResult.OK) {
             int id = listBox.SelectedIndex;
             listBox.Items.RemoveAt(id);
             listBox.Items.Insert(id, dialog.KeyValuePair);
         }
     }
 }