using ComputerSalesApp.Services; using ComputerSalesApp.UI; namespace ComputerSalesApp; internal static class Program { [STAThread] private static void Main() { Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { bool restart; do { restart = false; using var loginForm = new LoginForm(); if (loginForm.ShowDialog() != DialogResult.OK || loginForm.Session == null) { break; } using var mainForm = new MainForm(loginForm.Session); Application.Run(mainForm); restart = mainForm.LogoutRequested; } while (restart); } catch (Exception ex) { ErrorHandler.Show("Критическая ошибка", "Приложение не смогло продолжить работу.", ex); } } }