RaUI/Source/Itrycn_Project2/Program.cs
鑫Intel 8b41f58f5c ### 2021-07-01更新
------
#### ryControlsV4    V3.0.2107.0101
- *.[新增]新增Sheng.Winform.Controls部分控件。

#### RyWeb    V3.0.2107.0101
- *.[新增]QuickWeb新增引用页设置。
#### MyDbV4    V3.0.2107.0101
- *.[新增]支持忽略大小写的替换功能。
2021-07-04 09:41:31 +08:00

58 lines
2.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Itrycn;
using Itrycn_Project2;
using ryCommon;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Itrycn_Project2
{
static class Program
{
static System.Threading.Mutex run;
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
Application.ThreadException += Application_ThreadException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Soft_ConstInfo.SysDataFolder = ryCommon.RyFiles.GetRealPath(Soft_ConstInfo.SysDataFolder);
Soft_ConstInfo.UserDataFolder = ryCommon.RyFiles.GetRealPath(Soft_ConstInfo.UserDataFolder);
run = new System.Threading.Mutex(true, Soft_ConstInfo.Soft_Id, out bool runone);
if (!runone) //已经运行了
{
ryCommon.Ini ini = new ryCommon.Ini(Soft_ConstInfo.UserDataFolder + "\\Win.dat");
ryControls.Win32.SendMessage((IntPtr)ini.ReadIni(Soft_ConstInfo.Soft_Id, "hwnd", 0), 17189, 100, 100);
}
else
{
//Application.Run(new FrmStart(args));
Application.Run(new FrmStart(args));
}
//FrmLogin frm = new FrmLogin();
//if (frm.ShowDialog() == DialogResult.OK)
//{
// Application.Run(new Frmmain());
//}
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception ex = e.ExceptionObject as Exception;
MessageBox.Show(string.Format("捕获到未处理异常:{0}\r\n异常信息{1}\r\n异常堆栈{2}\r\nCLR即将退出{3}", ex.GetType(), ex.Message, ex.StackTrace, e.IsTerminating));
RyFiles.WriteAllText(Application.StartupPath + "\\错误.txt", DateTime.Now.ToString() + "\r\n\r\n错误描述:" + ex.Message + "\r\n\r\n异常堆栈" + ex.StackTrace + "\r\n\r\n异常方法" + ex.TargetSite, Encoding.UTF8);
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
Exception ex = e.Exception;
MessageBox.Show(string.Format("捕获到未处理异常:{0}\r\n异常信息{1}\r\n异常堆栈{2}", ex.GetType(), ex.Message, ex.StackTrace));
RyFiles.WriteAllText(Application.StartupPath + "\\线程错误.txt", DateTime.Now.ToString() + "\r\n\r\n错误描述:" + ex.Message + "\r\n\r\n异常堆栈" + ex.StackTrace + "\r\n\r\n异常方法" + ex.TargetSite, Encoding.UTF8);
}
}
}