void AddToolToolStripMenuItemClick(object sender, EventArgs e) { WOL2Tool nt = new WOL2Tool(); DlgEditTool dlg = new DlgEditTool(nt); if (dlg.ShowDialog(this) == DialogResult.OK && nt.IsValid()) { m_Tools.Add(nt.GetName(), nt); AddTool(nt); } }
void ModifyToolToolStripMenuItemClick(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { ListViewItem i = listView1.SelectedItems[0]; if (i != null) { WOL2Tool nt = new WOL2Tool(i.Text, i.SubItems[1].Text, i.SubItems[2].Text, i.ImageKey); DlgEditTool dlg = new DlgEditTool(nt); if (dlg.ShowDialog(this) == DialogResult.OK && nt.IsValid()) { i.SubItems[0].Text = nt.GetName(); i.SubItems[1].Text = nt.GetCommand(); i.SubItems[2].Text = nt.GetCmdLine(); // Load the icon string icon = nt.GetIconFileName(); i.ImageKey = nt.GetIconFileName(); if (icon != null && File.Exists(icon)) { if (!imgLstTools.Images.ContainsKey(icon)) { imgLstTools.Images.Add(icon, Image.FromFile(icon)); } i.ImageKey = icon; } WOL2Tool t = (WOL2Tool)i.Tag; if (t != null) { t.SetName(nt.GetName()); t.SetCommand(nt.GetCommand()); t.SetCmdLine(nt.GetCmdLine()); t.SetIconFileName(nt.GetIconFileName()); } } } } }
void ModifyToolToolStripMenuItemClick(object sender, EventArgs e) { if( listView1.SelectedItems.Count > 0 ) { ListViewItem i = listView1.SelectedItems[0]; if( i != null ) { WOL2Tool nt = new WOL2Tool( i.Text, i.SubItems[1].Text, i.SubItems[2].Text, i.ImageKey ); DlgEditTool dlg = new DlgEditTool( nt ); if( dlg.ShowDialog( this ) == DialogResult.OK && nt.IsValid() ) { i.SubItems[0].Text = nt.GetName(); i.SubItems[1].Text = nt.GetCommand(); i.SubItems[2].Text = nt.GetCmdLine(); // Load the icon string icon = nt.GetIconFileName(); i.ImageKey = nt.GetIconFileName(); if (icon != null && File.Exists(icon)) { if( !imgLstTools.Images.ContainsKey( icon) ) imgLstTools.Images.Add(icon, Image.FromFile(icon)); i.ImageKey = icon; } WOL2Tool t = (WOL2Tool)i.Tag; if( t != null ) { t.SetName( nt.GetName() ); t.SetCommand( nt.GetCommand() ); t.SetCmdLine( nt.GetCmdLine() ); t.SetIconFileName(nt.GetIconFileName()); } } } } }
void AddToolToolStripMenuItemClick(object sender, EventArgs e) { WOL2Tool nt = new WOL2Tool(); DlgEditTool dlg = new DlgEditTool( nt ); if( dlg.ShowDialog( this ) == DialogResult.OK && nt.IsValid() ) { m_Tools.Add( nt.GetName(), nt ); AddTool( nt ); } }