using System; using System.Windows.Forms; namespace DeanOfficeApp { static class Program { [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); using (var login = new LoginForm()) { if (login.ShowDialog() == DialogResult.OK) { try { Application.Run(new MainForm(login.UserRole, login.Username, login.FullName)); } catch (Exception ex) { MessageBox.Show($"Ошибка при открытии главной формы: {ex.Message}\n\n{ex.StackTrace}", "Критическая ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { Application.Exit(); } } } } }