From 8e69fa569da18f64c4ce45c7432149f18a71d5d8 Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Sun, 22 May 2022 07:56:31 +0300 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=BE=D0=B5=D0=B4=D0=B8=D0=BD=D1=8F?= =?UTF-8?q?=D0=B5=D1=82=20=D0=B0=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8E=20=D1=81=20=D1=84=D0=BE=D1=80=D0=BC=D0=BE?= =?UTF-8?q?=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AuthorizationForm.Designer.cs | 4 ++++ AuthorizationForm.cs | 14 ++++++++++++++ Globals.cs | 2 ++ Program.cs | 6 +++--- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/AuthorizationForm.Designer.cs b/AuthorizationForm.Designer.cs index 88bda87..1171308 100644 --- a/AuthorizationForm.Designer.cs +++ b/AuthorizationForm.Designer.cs @@ -45,6 +45,7 @@ this.loginButton.TabIndex = 0; this.loginButton.Text = "Авторизоваться"; this.loginButton.UseVisualStyleBackColor = true; + this.loginButton.Click += new System.EventHandler(this.loginButton_Click); // // registerButton // @@ -89,6 +90,7 @@ this.entryPassword.Name = "entryPassword"; this.entryPassword.Size = new System.Drawing.Size(195, 20); this.entryPassword.TabIndex = 4; + this.entryPassword.UseSystemPasswordChar = true; // // AuthorizationForm // @@ -101,6 +103,8 @@ this.Controls.Add(this.entryLogin); this.Controls.Add(this.registerButton); this.Controls.Add(this.loginButton); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; this.Name = "AuthorizationForm"; this.Text = "Авторизоваться"; this.ResumeLayout(false); diff --git a/AuthorizationForm.cs b/AuthorizationForm.cs index 5c3193b..e21020f 100644 --- a/AuthorizationForm.cs +++ b/AuthorizationForm.cs @@ -17,5 +17,19 @@ namespace AwesomeEmailExtractor InitializeComponent(); } + private void loginButton_Click(object sender, EventArgs e) + { + try + { + Globals.currentUser = Authorization.Login(entryLogin.Text, entryPassword.Text); + this.Close(); + + new MainForm().Show(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } } } diff --git a/Globals.cs b/Globals.cs index 4739d57..afb38d5 100644 --- a/Globals.cs +++ b/Globals.cs @@ -15,6 +15,8 @@ namespace AwesomeEmailExtractor public static SqliteConnection db { get; set; } public static SqliteConnection logsDb { get; set; } + public static User currentUser { get; set; } + public static string getAppDirectory() { return Path.Combine( diff --git a/Program.cs b/Program.cs index 5067411..9047a40 100644 --- a/Program.cs +++ b/Program.cs @@ -18,11 +18,11 @@ namespace AwesomeEmailExtractor { preMain(); - Logs.GetLogs(); - Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); + + new AuthorizationForm().Show(); + Application.Run(); postMain(); }