LoginWindow.xaml.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 WPFYifis2
  16. {
  17. /// <summary>
  18. /// Interaction logic for MainWindow.xaml
  19. /// </summary>
  20. public partial class LoginWindow : Window
  21. {
  22. public LoginWindow()
  23. {
  24. InitializeComponent();
  25. }
  26. private void Button_Click(object sender, RoutedEventArgs e)
  27. {
  28. bool suc = Presenter.Singleton.Login(Login.Text, Password.Text);
  29. if (suc)
  30. {
  31. (new MainWindow()).Show();
  32. Close();
  33. return;
  34. }
  35. MessageBox.Show("Такого пользователь не существует");
  36. }
  37. private void TextBox_TextChanged(object sender, RoutedEventArgs e)
  38. {
  39. }
  40. private void HidenTextL(object sender, MouseEventArgs e)
  41. {
  42. Login.Text = "";
  43. Login.IsReadOnly = false;
  44. }
  45. private void LeaveCursorL(object sender, MouseEventArgs e)
  46. {
  47. if (Login.Text == "")
  48. {
  49. Login.Text = "Введите логин";
  50. Login.IsReadOnly = true;
  51. }
  52. }
  53. private void HidenTextP(object sender, MouseEventArgs e)
  54. {
  55. Password.Text = "";
  56. Password.IsReadOnly = false;
  57. }
  58. private void LeaveCursorP(object sender, MouseEventArgs e)
  59. {
  60. if (Password.Text == "")
  61. {
  62. Password.Text = "Введите пароль";
  63. Password.IsReadOnly = true;
  64. }
  65. }
  66. private void Window_Loaded(object sender, RoutedEventArgs e)
  67. {
  68. }
  69. }
  70. }