Program.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Linq;
  5. using System.Security.Cryptography.X509Certificates;
  6. using System.Threading.Tasks;
  7. using System.Windows.Forms;
  8. namespace DataManager
  9. {
  10. internal static class Program
  11. {
  12. /// <summary>
  13. /// 应用程序的主入口点。
  14. /// </summary>
  15. [STAThread]
  16. static void Main()
  17. {
  18. Application.EnableVisualStyles();
  19. Application.SetCompatibleTextRenderingDefault(false);
  20. if (ConfigurationManager.AppSettings["bypassLogin"] != "true")
  21. {
  22. // 正式发布时的登录页面
  23. Login login = new Login();
  24. if (login.ShowDialog() == DialogResult.OK)
  25. {
  26. if (UIConstants.user.UserId > 0)
  27. {
  28. Application.Run(new frmDataManager(UIConstants.user.UserId));
  29. }
  30. else
  31. {
  32. MessageBox.Show("找不到用户,奇了个怪", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
  33. Application.Exit();
  34. }
  35. }
  36. else
  37. {
  38. Application.Exit();
  39. }
  40. }
  41. else
  42. {
  43. // 调试时跳过登录的代码
  44. UIConstants.user.UserId = 123;
  45. Application.Run(new frmDataManager(UIConstants.user.UserId));
  46. }
  47. }
  48. }
  49. }