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.Navigation;
using System.Windows.Shapes;

namespace WPFYifis2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class LoginWindow : Window
    {
        public LoginWindow()
        {
            InitializeComponent();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            bool suc = Presenter.Singleton.Login(Login.Text, Password.Text);

            if (suc)
            {
                (new MainWindow()).Show();
                Close();
                return;
            }

            MessageBox.Show("Такого пользователь не существует");
        }

        private void TextBox_TextChanged(object sender, RoutedEventArgs e)
        {

            
        }

        private void HidenTextL(object sender, MouseEventArgs e)
        {
            Login.Text = "";
            Login.IsReadOnly = false;

        }
        private void LeaveCursorL(object sender, MouseEventArgs e)
        {
            if (Login.Text == "")
            {
                Login.Text = "Введите логин";
                Login.IsReadOnly = true;
            }

        }
        private void HidenTextP(object sender, MouseEventArgs e)
        {
            Password.Text = "";
            Password.IsReadOnly = false;
        }
        private void LeaveCursorP(object sender, MouseEventArgs e)
        {
            if (Password.Text == "")
            {
                Password.Text = "Введите пароль";
                Password.IsReadOnly = true;
            }
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            
        }
    }
}
