private void scriptToolStripMenuItem_Click(object sender, EventArgs e) { if (this.ListView.SelectedItems.Count == 0) { return; } object selectedObject = this.ListView.SelectedItems[0].Tag; IScriptable scriptableObject = selectedObject as IScriptable; if (scriptableObject != null) { StringCollection strings = scriptableObject.Script(); TextOutputForm frm = new TextOutputForm(strings); frm.ShowDialog(this); } }