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(); }