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.
81 lines
2.6 KiB
C#
81 lines
2.6 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.Xml;
|
|
using System.Configuration;
|
|
using Mesnac.PlugIn.View;
|
|
using System.IO;
|
|
using Mesnac.Basic;
|
|
using Mesnac.Equips;
|
|
using ICSharpCode.Core;
|
|
using System.Reflection;
|
|
using System.Reflection.Emit;
|
|
using Mesnac.Controls.Default;
|
|
|
|
namespace Mesnac.PlugIn.MCProject
|
|
{
|
|
public partial class FrmMCProject : DefaultViewContent
|
|
{
|
|
private string _projectPath = Path.Combine(Application.StartupPath, ConfigurationManager.AppSettings["MCProjectPath"]); //组态工程路径
|
|
//private TreeView _tree = null; //解析组态工程后的工程树
|
|
|
|
public FrmMCProject()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void FrmMCProject_Load(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//初始化工程路径
|
|
if (!Directory.Exists(this._projectPath))
|
|
{
|
|
Directory.CreateDirectory(this._projectPath);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
this.InitMethod();
|
|
}
|
|
/// <summary>
|
|
/// 初始化方法
|
|
/// </summary>
|
|
public void InitMethod()
|
|
{
|
|
Mesnac.Gui.Common.RunEngine.Instance.Init(this._projectPath , false, false); //初始化运行引擎
|
|
if (Mesnac.Gui.Common.RunEngine.Instance.Tree != null)
|
|
{
|
|
TreeNode nodeForms = Mesnac.Gui.Common.RunEngine.Instance.Tree.GetFirstNodeByNodeName(FixNodeName.NodeFormName);
|
|
if (nodeForms != null && nodeForms.Nodes.Count > 0)
|
|
{
|
|
foreach (TreeNode tn in nodeForms.Nodes)
|
|
{
|
|
LinkLabel formLink = new LinkLabel();
|
|
formLink.Text = tn.Text;
|
|
formLink.Tag = tn;
|
|
formLink.Click += new EventHandler(formLink_Click);
|
|
this.flowLayoutPanel1.Controls.Add(formLink);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void formLink_Click(object sender, EventArgs e)
|
|
{
|
|
LinkLabel formLink = sender as LinkLabel;
|
|
TreeNode tn = formLink.Tag as TreeNode;
|
|
Mesnac.Gui.Common.RunEngine.Instance.Simulation(tn, FormShowType.Form);
|
|
}
|
|
|
|
|
|
}
|
|
}
|