MainWindow.xaml.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace Task1
  16. {
  17. /// <summary>
  18. /// Логика взаимодействия для MainWindow.xaml
  19. /// </summary>
  20. public partial class MainWindow : Window
  21. {
  22. public MainWindow()
  23. {
  24. InitializeComponent();
  25. }
  26. public void Clik_Come( object a, RoutedEventArgs q)
  27. {
  28. TaskContext taskContext = new TaskContext();
  29. var user_ = taskContext.User.Where(u => u.Login == Login1.Text && u.Password == Password1.Password);
  30. if (user_.Count() != 0)
  31. {
  32. Window2 window2 = new Window2();
  33. window2.Show();
  34. window2.Close();
  35. }
  36. else
  37. {
  38. MessageBox.Show("Не правильный логин или пароль ");
  39. }
  40. }
  41. private void ClickReg(object sender, RoutedEventArgs e)
  42. {
  43. Window1 window1 = new Window1();
  44. window1.Show();
  45. window1.Close();
  46. }
  47. }
  48. }