ab56a9bcf7
SVN-Revision: r240
152 lines
4.9 KiB
C#
152 lines
4.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using DevExpress.UserSkins;
|
|
using DevExpress.Skins;
|
|
using DevExpress.LookAndFeel;
|
|
using Lskj.Util;
|
|
using Lskj.Model;
|
|
using Lskj.Business;
|
|
using System.Threading;
|
|
using System.Globalization;
|
|
using Lskj.Control;
|
|
using Lskj.Control.Model;
|
|
using Lskj.Core;
|
|
using Lskj.Data;
|
|
using System.Text;
|
|
using System.Data;
|
|
using Lskj.Business.Impl;
|
|
|
|
namespace Lskj.SweepCodeExe
|
|
{
|
|
static class Program
|
|
{
|
|
/// <summary>
|
|
/// 主程序
|
|
/// </summary>
|
|
private static FrmMain _frmMain = null;
|
|
/// <summary>
|
|
/// 应用程序的主入口点。
|
|
/// </summary>
|
|
[STAThread]
|
|
static void Main()
|
|
{
|
|
try
|
|
{
|
|
// 汉化DevExpress界面
|
|
Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh-Hans");
|
|
// 设置皮肤
|
|
BonusSkins.Register();
|
|
SkinManager.EnableFormSkins();
|
|
|
|
//处理未捕获的异常
|
|
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
|
|
|
|
|
|
// 启动程序
|
|
StartForm();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageUtil.Show(ex);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:程序启动入口</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-09 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public static void StartForm()
|
|
{
|
|
bool isStart = true;
|
|
// 加载Splash动画界面
|
|
SplashForm.ShowForm();
|
|
// C#数据库连接检查
|
|
if (!DBConfig.Instance.CreateConnection())
|
|
{
|
|
MessageUtil.Show(ResourceKeys.UnConnectServer);
|
|
SplashForm.HideForm();
|
|
}
|
|
SplashForm.HideForm();
|
|
FrmLogin login = new FrmLogin();
|
|
DialogResult result = login.ShowDialog();
|
|
if (ERPInfo.Instance.LoginResult == false)
|
|
return;
|
|
if (result == DialogResult.OK)
|
|
{
|
|
FrmMain main = new FrmMain();
|
|
string[] obj = new[] { "各站点录入", "1", "管理员", "1", "4200601", "1737" };
|
|
main.SysModel = new DynamicProductionModel(obj);
|
|
main.ShowDialog();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:重新启动</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-14 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="skipMenu">是否跳过子系统选择(适用于切换用户).</param>
|
|
public static void ReStartMain(bool skipMenu = false)
|
|
{
|
|
if (_frmMain != null)
|
|
{
|
|
_frmMain.Close();
|
|
_frmMain.Dispose();
|
|
_frmMain = null;
|
|
}
|
|
|
|
bool isStart = true;
|
|
if (isStart)
|
|
{
|
|
// 直接进入主界面
|
|
RunMainForm();
|
|
}
|
|
}
|
|
|
|
|
|
/// <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>说明:处理异常</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-22 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="ThreadExceptionEventArgs"/> instance containing the event data.</param>
|
|
static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
|
|
{
|
|
MessageUtil.Show(e.Exception);
|
|
LogHelper.Instance.WriteError(e.Exception);
|
|
}
|
|
}
|
|
}
|