ab56a9bcf7
SVN-Revision: r240
226 lines
7.9 KiB
C#
226 lines
7.9 KiB
C#
using DevExpress.Utils;
|
|
using DevExpress.XtraTab;
|
|
using Lskj.Control;
|
|
using Lskj.Core;
|
|
using Lskj.Util;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Lskj.WorkshopProgram
|
|
{
|
|
public sealed class Manager
|
|
{
|
|
/// <summary>
|
|
/// 主程序
|
|
/// </summary>
|
|
private static FrmMain _frmMain = null;
|
|
public static XtraTabControl TabMain = null;
|
|
public static int MinusTheHeight = 0;
|
|
public static int frmHeight = 0;
|
|
public static string NotificationDataSQL;//sql编号
|
|
public static string ConditionNumber;//是否有条件
|
|
public static exetowinform fr = null;
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 记录当前打开的窗口
|
|
/// </summary>
|
|
public static Dictionary<string, DllModule> ModuleForms = new Dictionary<string, DllModule>();
|
|
|
|
/// <summary>
|
|
/// <para>说明:打开模块</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-18 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public static void OpenModule(string name, string route)
|
|
{
|
|
try
|
|
{
|
|
DllModule module = new DllModule
|
|
{
|
|
|
|
name = name,
|
|
route = route
|
|
};
|
|
string[] args = new string[]
|
|
{
|
|
name,
|
|
route
|
|
};
|
|
AddModuleToTab(module, args);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
MessageUtil.Show(ex.Message);
|
|
}
|
|
}
|
|
|
|
//}
|
|
/// <summary>
|
|
/// <para>说明:添加模块到tab中</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-16 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="tabMain">The tab main.</param>
|
|
/// <param name="module">The module.</param>
|
|
/// <param name="args">The arguments.</param>
|
|
public static void AddModuleToTab(DllModule module, string[] args)
|
|
{
|
|
try
|
|
{
|
|
//IForm iform = FormHelper.LoadDllForm(module.DllName, args);
|
|
// 菜单打开的模块默认最大化,界面FormState设置为Normal模式,否则会出现界面不是全屏,会显示默认阴影界面
|
|
//iform.SubForm.WindowState = _frmMain.WindowState;
|
|
|
|
Form form = new Form(); // 表示组成应用程序的用户界面的窗口或对话框。
|
|
Panel panel = new Panel();
|
|
fr = new exetowinform(panel, "");
|
|
fr.Start(module.route);
|
|
panel.Dock = DockStyle.Fill;
|
|
form.Controls.Add(panel);
|
|
string guid = Guid.NewGuid().ToString();
|
|
|
|
|
|
XtraTabPage tp = new XtraTabPage();
|
|
tp.Text = module.name;
|
|
tp.Tag = guid;
|
|
|
|
// 这个必须有不然会提示:"不能向tabControl中添加顶级控件"
|
|
form.TopLevel = false;
|
|
form.Location = new Point(0, 0);
|
|
//form.Dock = DockStyle.Fill;
|
|
form.Width = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
|
|
form.Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - MinusTheHeight;
|
|
form.FormBorderStyle = FormBorderStyle.None;
|
|
tp.AutoScroll = true;
|
|
tp.Controls.Add(form);
|
|
tp.ShowCloseButton = DefaultBoolean.True;
|
|
tp.Dock = DockStyle.Fill;
|
|
TabMain.TabPages.Add(tp);
|
|
TabMain.SelectedTabPage = tp;
|
|
|
|
|
|
form.Show();
|
|
ModuleForms.Add(guid, module);
|
|
//LastModuleForm.Add(module);
|
|
//Lskj.Main.Model.AutoSizeChange.ControllInitializeSize(form);//调整控件大小
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageUtil.Show(ex.InnerException != null ? ex.InnerException.Message : ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:特殊dll模块处理</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-20 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="dllName">Name of the DLL.</param>
|
|
/// <returns>System.String.</returns>
|
|
private static string ReplaceDllFileName(string dllName)
|
|
{
|
|
switch (dllName.ToLower().Trim())
|
|
{
|
|
case "pubspec.dll":
|
|
dllName = "Lskj.PubSpec.dll";
|
|
break;
|
|
}
|
|
return dllName;
|
|
}
|
|
private static void ExitSystem()
|
|
{
|
|
try
|
|
{
|
|
// 退出系统
|
|
if (DBConfig.Instance.NoticeExit)
|
|
{
|
|
Process[] p1 = Process.GetProcessesByName("Ls_Notice");
|
|
foreach (Process item in p1)
|
|
item.Kill();
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <para>说明:打开主程序</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-14 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns>DialogResult.</returns>
|
|
private static DialogResult RunMainForm()
|
|
{
|
|
_frmMain = new FrmMain();
|
|
return _frmMain.ShowDialog();
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:获得通知数据执行的sql编码</para>
|
|
/// <para>创建人:曹屹峰</para>
|
|
/// <para>创建日期:2021-11-3 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private static void GetNotificationDataSQL()
|
|
{
|
|
|
|
string[] PwdState = AESUtil.Decrypt(IniHelper.Read(DBConfig.Instance.ServerName + DBConfig.Instance.DataBase)).Split('^');
|
|
if (PwdState.Length == 3)
|
|
{
|
|
NotificationDataSQL = PwdState[1].ToString();
|
|
ConditionNumber = PwdState[1].ToString();
|
|
return;
|
|
}
|
|
|
|
if (Lskj.Business.Impl.BaseImpl.HasExistsColumn("p_systemNotification", "billdocument_id"))
|
|
{
|
|
ConditionNumber = "1";
|
|
}
|
|
if (Lskj.Business.Impl.BaseImpl.HasExistsColumn("p_systemNotification", "msgid"))
|
|
{
|
|
NotificationDataSQL = "1";
|
|
}
|
|
else
|
|
if (Lskj.Business.Impl.BaseImpl.HasExistsColumn("p_systemNotification", "menuid"))
|
|
{
|
|
NotificationDataSQL = "2";
|
|
}
|
|
else
|
|
{
|
|
NotificationDataSQL = "3";
|
|
}
|
|
IniHelper.Write(DBConfig.Instance.ServerName + DBConfig.Instance.DataBase, AESUtil.Encrypt("NotificationDataSQL,ConditionNumber" + "^" + NotificationDataSQL + "^" + ConditionNumber));
|
|
|
|
}
|
|
}
|
|
}
|