You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.8 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ToDoApp.Model;
using ToDoApp.Service;
namespace ToDoApp.SubWindow
{
/// <summary>
/// LoginWindow.xaml에 대한 상호 작용 논리
/// </summary>
public partial class LoginWindow : Window
{
public User User { get; set; }
public LoginWindow()
{
InitializeComponent();
}
private bool CheckLogin(string name, string password)
{
if (!UserService.Instance.CheckUserLogin(name, password))
return false;
else
return true;
}
private void btnLogin_Click(object sender, RoutedEventArgs e)
{
if (!CheckLogin(tbName.Text, pbPassword.Password))
{
MessageBox.Show("로그인 정보가 올바르지 않습니다.");
}
else
{
this.User = UserService.Instance.FindUser(tbName.Text);
this.DialogResult = true;
this.Close();
}
}
private void btnJoin_Click(object sender, RoutedEventArgs e)
{
JoinWindow dlg = new JoinWindow();
dlg.ShowDialog();
}
private void tb_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key != Key.Enter)
return;
btnLogin_Click(this, null);
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
tbName.Focus();
}
}
}