private void applicationLauncherTreeView_DoubleClick(object sender, EventArgs e) { if (applicationLauncherTreeView.SelectedNode is launcherCmdNode) { launcherCmdNode l = (launcherCmdNode)applicationLauncherTreeView.SelectedNode; if (l.xmlenabled == false) { MessageBox.Show("This item cannot be executed as it is disabled"); } else { if (l.isAction) { stdNetworkConnection.SendString("<TRIGGERED ENVELOPEID=\"" + this.applicationLauncherId + "\" ID=\"APPLAUNCHEREVENT\" TYPE=\"" + System.Security.SecurityElement.Escape(l.cmd) + "\"/>"); } else { if (l.waiting) { stdNetworkConnection.SendString("<TRIGGERED ENVELOPEID=\"" + this.applicationLauncherId + "\" ID=\"EXECWAIT\" PROGRAMNAME=\"" + System.Security.SecurityElement.Escape(l.cmd) + "\"/>"); } else { stdNetworkConnection.SendString("<TRIGGERED ENVELOPEID=\"" + this.applicationLauncherId + "\" ID=\"EXEC\" PROGRAMNAME=\"" + System.Security.SecurityElement.Escape(l.cmd) + "\"/>"); } } } } }
private void addTreeNodes(TreeNode root, AubitDesktop.Xml.StartMenuGroup startMenuGroup) { bool hasCommands = false; TreeNode node; node = new TreeNode(startMenuGroup.text); root.Nodes.Add(node); foreach (object o in startMenuGroup.Items) { if (o is AubitDesktop.Xml.StartMenuGroup) { addTreeNodes(node, (AubitDesktop.Xml.StartMenuGroup)o); } if (o is AubitDesktop.Xml.StartMenuCommand) { TreeNode cmdNode; AubitDesktop.Xml.StartMenuCommand smc; smc = (AubitDesktop.Xml.StartMenuCommand)o; cmdNode = new launcherCmdNode(smc.text, smc.exec, smc.disabled, smc.image, smc.waiting, smc.hotKey, smc.isEvent); node.Nodes.Add(cmdNode); hasCommands = true; } } if (!hasCommands) { node.Expand(); } }
private launcherCmdNode FindNodeInHierarchy(TreeNodeCollection nodes, string hotKey) { for (int iCount = 0; iCount < nodes.Count; iCount++) { if (nodes[iCount] is launcherCmdNode) { string launcherKey = ((launcherCmdNode)nodes[iCount]).hotKey; if (launcherKey == null) { continue; } if (launcherKey.ToLower() == hotKey.ToLower()) { return((launcherCmdNode)nodes[iCount]); } } if (nodes[iCount].Nodes != null) { launcherCmdNode found = null; found = FindNodeInHierarchy(nodes[iCount].Nodes, hotKey); if (found != null) { return(found); } } } return(null); }
private bool scanApplicationLauncherForKey(string hotkey) { launcherCmdNode n = FindNodeInHierarchy(applicationLauncherTreeView.Nodes, hotkey); if (n == null) { return(false); } applicationLauncherTreeView.SelectedNode = n; applicationLauncherTreeView_DoubleClick(null, null); // MessageBox.Show("I'd like to run something please..."); return(true); }