diff --git a/DepartmentPortal/DepartmentPortalDesctop/FormEnter.cs b/DepartmentPortal/DepartmentPortalDesctop/FormEnter.cs index 5a5b36d..09a5943 100644 --- a/DepartmentPortal/DepartmentPortalDesctop/FormEnter.cs +++ b/DepartmentPortal/DepartmentPortalDesctop/FormEnter.cs @@ -37,6 +37,7 @@ namespace DepartmentPortalDesctop } catch (Exception ex) { + DialogResult = DialogResult.Cancel; ErrorMessanger.PrintErrorMessage("При аутентфикации возникла ошибка: ", new List> { new KeyValuePair("Аутентфикация", ex.Message) }); } } diff --git a/DepartmentPortal/DepartmentPortalDesctop/Program.cs b/DepartmentPortal/DepartmentPortalDesctop/Program.cs index 1bc9463..8da9821 100644 --- a/DepartmentPortal/DepartmentPortalDesctop/Program.cs +++ b/DepartmentPortal/DepartmentPortalDesctop/Program.cs @@ -24,11 +24,23 @@ namespace DepartmentPortalDesctop Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - var form = new FormEnter(); - - if (form.ShowDialog() == DialogResult.OK && securityManager.IsAuth) + int counter = 3; + while (counter > 0) { - Application.Run(new FormMain()); + var form = new FormEnter(); + if (form.ShowDialog() == DialogResult.OK) + { + break; + } + counter--; + } + + if (counter > 0) + { + if (securityManager.IsAuth) + { + Application.Run(new FormMain()); + } } } }