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()); } } } } }
public DlgEditTool(WOL2Tool t) { InitializeComponent(); m_theTool = t; txtName.Text = t.GetName(); txtCommand.Text = t.GetCommand(); txtParams.Text = t.GetCmdLine(); txtIconFileName.Text = t.GetIconFileName(); UpdateIcon(); }
public DlgEditTool( WOL2Tool t ) { InitializeComponent(); m_theTool = t; txtName.Text = t.GetName(); txtCommand.Text = t.GetCommand(); txtParams.Text = t.GetCmdLine(); txtIconFileName.Text = t.GetIconFileName(); UpdateIcon(); }
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); } }
private void AddTool(WOL2Tool t) { ListViewItem i = listView1.Items.Add(t.GetName()); i.SubItems.Add(t.GetCommand()); i.SubItems.Add(t.GetCmdLine()); i.Tag = t; // Load the icon string icon = t.GetIconFileName(); if (icon != null && File.Exists(icon)) { imgLstTools.Images.Add(icon, Image.FromFile(icon)); i.ImageKey = icon; } }
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 ); } }
private void AddTool( WOL2Tool t ) { ListViewItem i = listView1.Items.Add( t.GetName() ); i.SubItems.Add( t.GetCommand() ); i.SubItems.Add( t.GetCmdLine() ); i.Tag = t; // Load the icon string icon = t.GetIconFileName(); if (icon != null && File.Exists(icon)) { imgLstTools.Images.Add(icon, Image.FromFile(icon)); i.ImageKey = icon; } }