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;
using WpfAppProject.classes;

namespace WpfAppProject.pages
{
    /// <summary>
    /// Логика взаимодействия для PageAuto.xaml
    /// </summary>
    public partial class PageAuto : Page
    {
        public PageAuto()
        {
            InitializeComponent();
        }

        private void BtnEnter_Click(object sender, RoutedEventArgs e)
        {
            int i = TbPassword.Text.GetHashCode();
            TableUsers user = ClassBase.Base.TableUsers.FirstOrDefault(z => z.UserLogin == TbLogin.Text && z.UserPassword == i);
            if(user!= null)
            {
                ClassFrame.mainFrame.Navigate(new PageList(user));
            }
            else
            {
                MessageBox.Show("Нет такого пользователя", "Сообщение");
            }
        }

        private void BtnRegistration_Click(object sender, RoutedEventArgs e)
        {
            ClassFrame.mainFrame.Navigate(new PageRegistration());
        }
    }
}
