You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Mesnac.PlugIn.Pad;
using Mesnac.PlugIn.View;
using Mesnac.PlugIn.Workbench;
using Mesnac.Gui.PlugIn;
namespace Mesnac.Gui.Run.Pad
{
public partial class FrmSysFunction : DefaultPadContent
{
public FrmSysFunction()
{
InitializeComponent();
Workbench.WorkbenchSingleton.Workbench.AfterRefreshPlugIn += new EventHandler(Workbench_AfterRefreshPlugIn); //刷新插件事件处理
}
/// <summary>
/// 插件刷新事件处理
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Workbench_AfterRefreshPlugIn(object sender, EventArgs e)
{
this.treeView1.Nodes.Clear();
List<PlugIn.PlugInDescriptor> plugInCollection = sender as List<PlugIn.PlugInDescriptor>;
if (plugInCollection != null && plugInCollection.Count > 0)
{
foreach (PlugInDescriptor plugIn in plugInCollection)
{
TreeNode tnFunction = new TreeNode();
tnFunction.Text = plugIn.FunctionName;
if (plugIn.ViewContents != null && plugIn.ViewContents.Count > 0)
{
foreach (IViewContent view in plugIn.ViewContents)
{
TreeNode tnView = new TreeNode();
tnView.Text = view.TitleName;
tnView.Tag = view;
tnFunction.Nodes.Add(tnView);
}
}
this.treeView1.Nodes.Add(tnFunction);
}
}
this.treeView1.ExpandAll();
}
/// <summary>
/// 双击树节点事件处理程序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
IViewContent viewContent = e.Node.Tag as IViewContent;
if (viewContent != null)
{
Workbench.WorkbenchSingleton.Workbench.ShowView(viewContent);
}
}
}
}