void Add_Click(object sender, EventArgs e) { Control source = sender as Control; string filename; switch (source.Tag.ToString()) { case "Image": filename = getNewFile(ImageFilter); if (filename != null) { ImageList.Add(new System.IO.FileInfo(filename)); if (ImageList.Count == 1) { list_Image.SelectedIndex = -1; list_Image.SelectedIndex = 0; } } break; case "Video": filename = getNewFile(VideoFilter); if (filename != null) { VideoList.Add(new System.IO.FileInfo(filename)); if (VideoList.Count == 1) { list_Video.SelectedIndex = -1; list_Video.SelectedIndex = 0; } } break; case "Dialog": DialogList.AddNew(); if (DialogList.Count == 1) { list_dialog.SelectedIndex = -1; list_dialog.SelectedIndex = 0; } break; case "Interaction": Interactions.AddNew(); if (Interactions.Count == 1) { list_Interactions.SelectedIndex = -1; list_Interactions.SelectedIndex = 0; } break; case "Lines": using (Edit_Line d = new Edit_Line()) { if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK) { InteractionLines.Add(d.NewValue); if (InteractionLines.Count == 1) { list_Lines.SelectedIndex = -1; list_Lines.SelectedIndex = 0; } } } break; } }
private void btn_Edit1_Click(object sender, EventArgs e) { string oldval = InteractionLines[list_Lines.SelectedIndex]; using (Edit_Line d = new Edit_Line(oldval)) { if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK) { InteractionLines[list_Lines.SelectedIndex] = d.NewValue; } } }