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.
|
|
|
|
using HighWayIot.Log4net;
|
|
|
|
|
using HighWayIot.Winform.MainForm;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace HighWayIot.Winform
|
|
|
|
|
{
|
|
|
|
|
internal static class Program
|
|
|
|
|
{
|
|
|
|
|
private static LogHelper logger = LogHelper.Instance;
|
|
|
|
|
|
|
|
|
|
[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
|
|
|
|
|
[return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)]
|
|
|
|
|
public static extern bool AllocConsole();
|
|
|
|
|
|
|
|
|
|
[System.Runtime.InteropServices.DllImport("Kernel32")]
|
|
|
|
|
public static extern void FreeConsole();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 应用程序的主入口点。
|
|
|
|
|
/// </summary>
|
|
|
|
|
[STAThread]
|
|
|
|
|
static void Main()
|
|
|
|
|
{
|
|
|
|
|
AllocConsole();//调用系统API,调用控制台窗口
|
|
|
|
|
Console.OutputEncoding = System.Text.Encoding.UTF8;
|
|
|
|
|
|
|
|
|
|
// 设置控制台编码为系统默认编码(解决乱码问题)
|
|
|
|
|
Application.EnableVisualStyles();
|
|
|
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
|
|
|
//创建窗体
|
|
|
|
|
LoginForm loginform = new LoginForm();
|
|
|
|
|
logger.Info("程序初始化成功");
|
|
|
|
|
//验证成功显示主窗体
|
|
|
|
|
if (loginform.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
logger.Info("登陆成功");
|
|
|
|
|
Application.Run(new BaseForm());
|
|
|
|
|
}
|
|
|
|
|
FreeConsole();//释放控制台
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|