2021-04-13 17:46:18 +08:00
|
|
|
|
using DevExpress.XtraEditors;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Drawing;
|
2021-04-17 15:40:26 +08:00
|
|
|
|
using System.IO;
|
2021-04-13 17:46:18 +08:00
|
|
|
|
using System.Linq;
|
2021-04-17 15:40:26 +08:00
|
|
|
|
using System.Reflection;
|
2021-04-13 17:46:18 +08:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
using MES.Form;
|
2021-04-17 15:40:26 +08:00
|
|
|
|
using MES;
|
|
|
|
|
|
using WinformGeneralDeveloperFrame.Commons;
|
2021-04-13 17:46:18 +08:00
|
|
|
|
|
|
|
|
|
|
namespace WinformGeneralDeveloperFrame
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class FrmShowForm : DevExpress.XtraEditors.XtraForm
|
|
|
|
|
|
{
|
|
|
|
|
|
public MainForm mainform;
|
2021-04-17 15:40:26 +08:00
|
|
|
|
public int formId;
|
2021-04-13 17:46:18 +08:00
|
|
|
|
public FrmShowForm()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
ChildWinManagement.LoadMdiForm(mainform,typeof(XtraForm1));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void simpleButton2_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
ChildWinManagement.LoadMdiForm(mainform, typeof(FrmsysDataTable));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void simpleButton3_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
ChildWinManagement.LoadMdiForm(mainform, typeof(FrmsysDataBase));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void simpleButton4_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
ChildWinManagement.LoadMdiForm(mainform, typeof(frmSelectDataBase));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void simpleButton5_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
ChildWinManagement.LoadMdiForm(mainform, typeof(FrmsysMenu));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void simpleButton6_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
ChildWinManagement.LoadMdiForm(mainform, typeof(MES.Form.FrmsysUser));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void simpleButton8_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
ChildWinManagement.LoadMdiForm(mainform, typeof(FrmsysDictType));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void simpleButton7_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
ChildWinManagement.LoadMdiForm(mainform, typeof(FrmsysDictData));
|
|
|
|
|
|
}
|
2021-04-17 15:40:26 +08:00
|
|
|
|
|
|
|
|
|
|
private void FrmShowForm_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Init()
|
|
|
|
|
|
{
|
|
|
|
|
|
flowLayoutPanel1.Controls.Clear();
|
|
|
|
|
|
using (var db = new MESDB())
|
|
|
|
|
|
{
|
2021-04-25 18:49:28 +08:00
|
|
|
|
var data = db.sysMenuInfo.Where(p => p.pid == formId&&p.isEnabled).ToList();
|
2021-04-17 15:40:26 +08:00
|
|
|
|
|
|
|
|
|
|
foreach (var item in data)
|
|
|
|
|
|
{
|
|
|
|
|
|
SimpleButton btn = new SimpleButton();
|
|
|
|
|
|
btn.Name = "btn" + item.id;
|
|
|
|
|
|
btn.Size = new System.Drawing.Size(90, 75);
|
|
|
|
|
|
btn.Text = item.name;
|
|
|
|
|
|
btn.Click += (o, args) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
string[] itemArray = item.winformType.Split(new char[] {',', ';'});
|
|
|
|
|
|
|
|
|
|
|
|
string type = itemArray[0].Trim();
|
|
|
|
|
|
string filePath = itemArray[1].Trim(); //必须是相对路径
|
|
|
|
|
|
|
|
|
|
|
|
//判断是否配置了显示模式,默认窗体为Show非模式显示
|
|
|
|
|
|
string showDialog = (itemArray.Length > 2) ? itemArray[2].ToLower() : "";
|
|
|
|
|
|
bool isShowDialog = (showDialog == "1") || (showDialog == "dialog");
|
|
|
|
|
|
|
|
|
|
|
|
string dllFullPath = Path.Combine(Application.StartupPath, filePath);
|
|
|
|
|
|
Assembly tempAssembly = System.Reflection.Assembly.LoadFrom(dllFullPath);
|
|
|
|
|
|
if (tempAssembly != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Type objType = tempAssembly.GetType(type);
|
|
|
|
|
|
ChildWinManagement.LoadMdiForm(mainform, objType);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
ex.Message.ShowError();
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
flowLayoutPanel1.Controls.Add(btn);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-04-13 17:46:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|