/// <summary> /// Removes a launcher entry from the list /// </summary> /// <param name="entry">The LauncherEntry that should be removed</param> public void DeleteEntry(LauncherEntry entry) { if (m_Entries.Contains(entry)) { m_Entries.Remove(entry); if (OnEntriesChanged != null) { OnEntriesChanged(this, new EventArgs()); } } }
/// <summary> /// Edits an existing entry /// </summary> /// <param name="entry">The LauncherEntry to edit</param> public void EditEntry(LauncherEntry entry) { if (!m_Entries.Contains(entry)) return; var form = new LauncherForm(); form.SelectedEntry = entry; if (form.ShowDialog() == DialogResult.OK) { if (OnEntriesChanged != null) { OnEntriesChanged(this, new EventArgs()); } } }
/// <summary> /// Creates a new launcher entry /// </summary> public void CreateNewEntry() { TheBox.Forms.LauncherForm form = new TheBox.Forms.LauncherForm(); if (form.ShowDialog() == DialogResult.OK) { LauncherEntry entry = form.SelectedEntry; m_Entries.Add(entry); if (OnEntriesChanged != null) { OnEntriesChanged(this, new EventArgs()); } } }
/// <summary> /// Gets the TreeNodes representing the entries /// </summary> /// <param name="img">The image list that will hold the icons</param> /// <returns>An array list of treenodes</returns> public TreeNode[] GetTreeNodes(ImageList img) { if (m_Entries.Count == 0) { return(new TreeNode[0]); } if (img == null) { img = new ImageList(); } TreeNode[] nodes = new TreeNode[m_Entries.Count]; img.Images.Clear(); for (int i = 0; i < nodes.Length; i++) { // Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert LauncherEntry entry = m_Entries[i]; // Issue 10 - End nodes[i] = entry.TreeNode; if (entry.Valid) { Icon icon = FileIcon.GetSmallIcon(entry.Path); if (icon != null) { img.Images.Add(icon); nodes[i].ImageIndex = img.Images.Count - 1; nodes[i].SelectedImageIndex = img.Images.Count - 1; } } } return(nodes); }
/// <summary> /// Item selected on the tree /// </summary> private void tProgs_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { if ( e.Node != null ) { SelectedEntry = e.Node.Tag as LauncherEntry; } else { SelectedEntry = null; } }
private void bOk_Click(object sender, System.EventArgs e) { DialogResult = DialogResult.OK; if ( m_Entry == null ) m_Entry = new LauncherEntry(); m_Entry.Path = labFile.Text; m_Entry.Name = txName.Text; if ( txArgs.Text.Length > 0 ) m_Entry.Arguments = txArgs.Text; m_Entry.RunOnStartup = chkStartup.Checked; }
/// <summary> /// Edits an existing entry /// </summary> /// <param name="entry">The LauncherEntry to edit</param> public void EditEntry( LauncherEntry entry ) { if ( !m_Entries.Contains( entry ) ) return; TheBox.Forms.LauncherForm form = new TheBox.Forms.LauncherForm(); form.SelectedEntry = entry; if ( form.ShowDialog() == DialogResult.OK ) { if ( OnEntriesChanged != null ) { OnEntriesChanged( this, new EventArgs() ); } } }
/// <summary> /// Removes a launcher entry from the list /// </summary> /// <param name="entry">The LauncherEntry that should be removed</param> public void DeleteEntry( LauncherEntry entry ) { if ( m_Entries.Contains( entry ) ) { m_Entries.Remove( entry ); if ( OnEntriesChanged != null ) { OnEntriesChanged( this, new EventArgs() ); } } }