From ed1f4cf07ed28fa8ba5d1689b967a306ce1993be Mon Sep 17 00:00:00 2001 From: kotcheshir73 Date: Fri, 2 Apr 2021 20:53:03 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=B2=D1=82=D0=BE=D1=80=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=B0=D1=83=D1=82=D0=B5=D0=BD=D1=82=D0=B8=D1=84?= =?UTF-8?q?=D0=B8=D0=BA=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DepartmentPortalDesctop/FormEnter.cs | 1 + .../DepartmentPortalDesctop/Program.cs | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) 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()); + } } } }