private void treeView_func_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { TreeNode tn = treeView_func.SelectedNode; //判断是否是根节点 if (tn.Parent != null) { string name = treeView_func.SelectedNode.Text; //判断tabPage集合中是否含有该关键字的tabPage TabCore.SelectTabPage(name); } }
public FormMain() { InitializeComponent(); //线程安全开关,关闭这个就能跨线程访问控件 //CheckForIllegalCrossThreadCalls = false; _pluginsImport = new PluginsImport(); //导入插件 Compose(); //tab事件绑定 tabControl1.DoubleClick += tabControl1_DoubleClick; //设置版本号标签靠右 toolStripStatusLabel_productVersion.Alignment = ToolStripItemAlignment.Right; toolStripStatusLabel_productVersion.Text = string.Format("Version:{0}@KeePwn", Application.ProductVersion); TabCore.Init(this, this.tabControl1); //TabCore.Init(this, this.customTabControl1); TabCore.CreateTabPage_ShellManager(_pluginsImport.Plugins); InitTreeView(); InitUI.InitCustomShellType(); InitUI.InitGlobalSetting(); TreeNode treeNodeRoot1 = new TreeNode("Plugins"); this.treeView_func.Nodes.AddRange(new TreeNode[] { treeNodeRoot1 }); foreach (var plugin in _pluginsImport.Plugins) { //添加tabpage到TabCore中 string title = plugin.PluginAttribute.Title; //TabCore.CreateNewTabPage(name, ucplugin.Content); //添加到Plugins节点中 TreeNode treeNode1 = new TreeNode(title); treeNodeRoot1.Nodes.Add(treeNode1); //添加到Tsmi_Plugins中 ToolStripMenuItem item = new ToolStripMenuItem(); item.Name = title; item.Text = title; item.Checked = true; item.Tag = plugin; item.CheckOnClick = true; item.CheckedChanged += item_CheckedChanged; Tsmi_Plugins.DropDownItems.Add(item); //绑定插件的事件 plugin.HostService.ShowMsgInStatusBar = Host_ShowMsgInStatusBar; plugin.HostService.ShowMsgInAppDialog = Host_ShowMsgInAppDialog; plugin.HostService.CreateNewTabPage = Host_CreateNewTabPage; plugin.HostService.SubmitCommand = SubmitCommand; //ucplugin.Func.OnSubmit += Func_OnSubmit; } //test TreeNode treeNodeRoot2; treeNodeRoot2 = InitUI.GetCustomShellTypeTree(); treeNodeRoot2.Name = "ShellType"; treeNodeRoot2.Text = "ShellType"; this.treeView_func.Nodes.AddRange(new TreeNode[] { treeNodeRoot2 }); }
private void Host_CreateNewTabPage(string tabPageName, UserControl control) { TabCore.CreateNewTabPage(tabPageName, control); }