using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DataManager
{
    internal static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (ConfigurationManager.AppSettings["bypassLogin"] != "true")
            {
                // 正式发布时的登录页面
                Login login = new Login();

                if (login.ShowDialog() == DialogResult.OK)
                {
                    if (UIConstants.user.UserId > 0)
                    {
                        Application.Run(new frmDataManager(UIConstants.user.UserId));
                    }
                    else
                    {
                        MessageBox.Show("找不到用户,奇了个怪", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Application.Exit();
                    }
                }
                else
                {

                    Application.Exit();
                }
            }
            else 
            { 
                // 调试时跳过登录的代码
                UIConstants.user.UserId = 123;
                Application.Run(new frmDataManager(UIConstants.user.UserId));
            }
        
        }
    }
}