using FabitArchiwum.App.Model; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace FabitArchiwum.App { public partial class LoginForm : ComponentFactory.Krypton.Toolkit.KryptonForm { public LoginForm() { InitializeComponent(); } private void LoginForm_Shown(object sender, EventArgs e) { tbUser.Focus(); } private void tbUser_KeyDown_1(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; tbPassword.Focus(); } } private void tbPassword_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; btLogin.Focus(); } } private void btLogin_Click(object sender, EventArgs e) { if (AppHelper.GetInstance().login(new UserModel() { Username = tbUser.Text, Password = tbPassword.Text })) { this.Visible = false; var appForm = new AppForm(); appForm.ShowDialog(); this.Close(); } else { MessageBox.Show("Błąd logowania " + AppHelper.GetInstance().getErrorLogin(), "BŁĄD", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void LoginForm_FormClosing(object sender, FormClosingEventArgs e) { } private void LoginForm_FormClosed(object sender, FormClosedEventArgs e) { } } }