private void Menu_addremoveplugin_clicked(object sender, EventArgs e) { LACTreeNode nodetoDisplay = sc.ControlManage.lmcLWTreeView.SelectedNode as LACTreeNode; AddRemovePluginDlg f = new AddRemovePluginDlg(sc.ControlManage, sc.ControlManage.rootNode, sc.ControlManage.lmcLWTreeView); f.StartPosition = FormStartPosition.CenterParent; DialogResult dlg = f.ShowDialog(this); if (dlg == DialogResult.OK) { IsSetingsCanSave = true; if (sc.ControlManage.lmcLWTreeView.Nodes[0].Nodes.Contains(nodetoDisplay)) { sc.ControlManage.lmcLWTreeView.SelectedNode = nodetoDisplay; } else { sc.ControlManage.lmcLWTreeView.SelectedNode = sc.ControlManage.lmcLWTreeView.Nodes[0]; } sc.ControlManage.lmcLWTreeView.Select(); ShowControl(sc.ControlManage.lmcLWTreeView.SelectedNode as LACTreeNode); } }
public PluginStandalonePage(AddRemovePluginDlg parentDlg, Manage controlManage, LACTreeNode rootNode, LWTreeView lmcTreeview) { this.pageID = "PluginStandalonePage"; InitializeComponent(); SetPageTitle("Standalone"); _parentDlg = parentDlg; _controlManage = controlManage; _rootNode = rootNode; _lmcTreeview = lmcTreeview; TreeNode node = lmcTreeview.Nodes[0]; ImageList il = new ImageList(); this.ChosenPluginlistView.Items.Clear(); foreach (TreeNode n in node.Nodes) { ListViewItem lviArr; string str = n.Text; if (str.Contains("(")) { str = n.Text.Substring(0, n.Text.IndexOf('(')); } string[] values = { str }; lviArr = new ListViewItem(values); lviArr.Tag = n; lviArr.ImageIndex = n.ImageIndex;// (int)PluginStandalonePage.GetNodeType(n.Name); this.ChosenPluginlistView.Items.Add(lviArr); } visitOneNode(node as LACTreeNode, 0); if (this.PluginComboBox.Items.Count != 0) { this.PluginComboBox.SelectedIndex = 0; } }
public AddPluginsDlg(AddRemovePluginDlg grandparentDlg, Manage controlManage, LACTreeNode rootNode, PluginStandalonePage standalonePage, ListView listView) { InitializeComponent(); this.Text = "Add Stand-Alone Plug-In"; _controlManage = controlManage; _rootNode = rootNode; _standalonePage = standalonePage; _grandParent = grandparentDlg; this.PluginslistView = listView; //fill in PluginListview with existing plug-ins Logger.Log("AddPluginsDlg constructor", Logger.manageLogLevel); string[] dllPathList = Directory.GetFiles(Application.StartupPath, "*.dll"); List <ListViewItem> liItems = new List <ListViewItem>(); ImageList il = new ImageList(); foreach (string dllPath in dllPathList) { if (Path.GetFileName(dllPath) == sRootPluginName) { continue; } try { Assembly pluginDll = Assembly.LoadFile(dllPath); LACTreeNodeList nodesInAssembly = _controlManage.LoadPlugInsFromAssembly(pluginDll); foreach (LACTreeNode node in nodesInAssembly) { ListViewItem lvi = new ListViewItem(node.Text); lvi.Tag = node; lvi.ImageIndex = node.ImageIndex; liItems.Add(lvi); } } catch (BadImageFormatException) { // // Ignore DLLs that are not managed code. // } catch (Exception e) { Debugger.Log(9, "Exception", e.ToString()); } } // sort the items liItems.Sort(this); // add to the list view ListViewItem[] lvItems = new ListViewItem[liItems.Count]; liItems.CopyTo(lvItems); PluginlistView.Items.AddRange(lvItems); if (PluginlistView.Items.Count > 0) { PluginlistView.Items[0].Selected = true; } }
public PluginStandalonePage(AddRemovePluginDlg parentDlg, Manage controlManage, LACTreeNode rootNode, LWTreeView lmcTreeview) { this.pageID = "PluginStandalonePage"; InitializeComponent(); SetPageTitle("Standalone"); _parentDlg = parentDlg; _controlManage = controlManage; _rootNode = rootNode; _lmcTreeview = lmcTreeview; TreeNode node = lmcTreeview.Nodes[0]; ImageList il = new ImageList(); this.ChosenPluginlistView.Items.Clear(); foreach (TreeNode n in node.Nodes) { ListViewItem lviArr; string str = n.Text; if (str.Contains("(")) str = n.Text.Substring(0, n.Text.IndexOf('(')); string[] values = { str }; lviArr = new ListViewItem(values); lviArr.Tag = n; lviArr.ImageIndex = n.ImageIndex;// (int)PluginStandalonePage.GetNodeType(n.Name); this.ChosenPluginlistView.Items.Add(lviArr); } visitOneNode(node as LACTreeNode, 0); if (this.PluginComboBox.Items.Count != 0) { this.PluginComboBox.SelectedIndex = 0; } }