Program.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Windows.Forms;
  3. namespace DeanOfficeApp
  4. {
  5. static class Program
  6. {
  7. [STAThread]
  8. static void Main()
  9. {
  10. Application.EnableVisualStyles();
  11. Application.SetCompatibleTextRenderingDefault(false);
  12. using (var login = new LoginForm())
  13. {
  14. if (login.ShowDialog() == DialogResult.OK)
  15. {
  16. try
  17. {
  18. Application.Run(new MainForm(login.UserRole, login.Username, login.FullName));
  19. }
  20. catch (Exception ex)
  21. {
  22. MessageBox.Show($"Ошибка при открытии главной формы: {ex.Message}\n\n{ex.StackTrace}",
  23. "Критическая ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
  24. }
  25. }
  26. else
  27. {
  28. Application.Exit();
  29. }
  30. }
  31. }
  32. }
  33. }