соединяет авторизацию с формой

This commit is contained in:
Maxim Slipenko 2022-05-22 07:56:31 +03:00
parent 347551cf92
commit 8e69fa569d
Signed by: Maks1mS
GPG Key ID: 7461AF39A8705FB8
4 changed files with 23 additions and 3 deletions

View File

@ -45,6 +45,7 @@
this.loginButton.TabIndex = 0; this.loginButton.TabIndex = 0;
this.loginButton.Text = "Авторизоваться"; this.loginButton.Text = "Авторизоваться";
this.loginButton.UseVisualStyleBackColor = true; this.loginButton.UseVisualStyleBackColor = true;
this.loginButton.Click += new System.EventHandler(this.loginButton_Click);
// //
// registerButton // registerButton
// //
@ -89,6 +90,7 @@
this.entryPassword.Name = "entryPassword"; this.entryPassword.Name = "entryPassword";
this.entryPassword.Size = new System.Drawing.Size(195, 20); this.entryPassword.Size = new System.Drawing.Size(195, 20);
this.entryPassword.TabIndex = 4; this.entryPassword.TabIndex = 4;
this.entryPassword.UseSystemPasswordChar = true;
// //
// AuthorizationForm // AuthorizationForm
// //
@ -101,6 +103,8 @@
this.Controls.Add(this.entryLogin); this.Controls.Add(this.entryLogin);
this.Controls.Add(this.registerButton); this.Controls.Add(this.registerButton);
this.Controls.Add(this.loginButton); this.Controls.Add(this.loginButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "AuthorizationForm"; this.Name = "AuthorizationForm";
this.Text = "Авторизоваться"; this.Text = "Авторизоваться";
this.ResumeLayout(false); this.ResumeLayout(false);

View File

@ -17,5 +17,19 @@ namespace AwesomeEmailExtractor
InitializeComponent(); 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);
}
}
} }
} }

View File

@ -15,6 +15,8 @@ namespace AwesomeEmailExtractor
public static SqliteConnection db { get; set; } public static SqliteConnection db { get; set; }
public static SqliteConnection logsDb { get; set; } public static SqliteConnection logsDb { get; set; }
public static User currentUser { get; set; }
public static string getAppDirectory() public static string getAppDirectory()
{ {
return Path.Combine( return Path.Combine(

View File

@ -18,11 +18,11 @@ namespace AwesomeEmailExtractor
{ {
preMain(); preMain();
Logs.GetLogs();
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
new AuthorizationForm().Show();
Application.Run();
postMain(); postMain();
} }