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 ROGOZ.Pages { /// /// Логика взаимодействия для Authorization.xaml /// public partial class Authorization : Window { public Authorization() { InitializeComponent(); } private void BtnLogin_Click(object sender, RoutedEventArgs e) { //var curentUser = user1Entities.GetContext().User.FirstOrDefault(p => p.Login == TBoxLogin.Text && p.Password == PBoxPassword.Password); var curentUser = App.Context.User.FirstOrDefault(p => p.Login == TBoxLogin.Text && p.Password == PBoxPassword.Password); if (curentUser != null) { App.CurentUser = curentUser; MainWindow mainWindow = new MainWindow(); mainWindow.Show(); this.Close(); } else { MessageBox.Show("Пользователь с такими данными не найден.", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Warning); } //if (TBoxLogin.Text != "" && PBoxPassword.Password != "") //{ // //MessageBox.Show("Заходи", "хихихи", MessageBoxButton.OK, MessageBoxImage.Asterisk); // MainWindow mainWindow = new MainWindow(); // mainWindow.Show(); // this.Close(); //} //else //{ // MessageBox.Show("ДА.", "Капец", MessageBoxButton.OK, MessageBoxImage.Error); //} } private void PBoxPassword_PasswordChanged(object sender, RoutedEventArgs e) { if (PBoxPassword.Password.Length > 0) { WaterMarkerLabel.Visibility = Visibility.Collapsed; } else { WaterMarkerLabel.Visibility = Visibility.Visible; } } private void Page_MouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { DragMove(); } } private void btnClose_Click(object sender, RoutedEventArgs e) { this.Close(); } private void btnMinimize_Click(object sender, RoutedEventArgs e) { WindowState = WindowState.Minimized; } } }