mekasu0124

Untitled

Feb 24th, 2024
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.09 KB | None | 0 0
  1. public User CheckInputs()
  2. {
  3.     if (!_hp.ValidateUsername(Username))
  4.     {
  5.         IsVisible = true;
  6.         Background = "#E2EB23";
  7.         ErrorText = "Invalid Username/Password Format. Try Again!";
  8.  
  9.         Task.Delay(3000).ContinueWith((task) =>
  10.         {
  11.             Dispatcher.UIThread.Invoke(() =>
  12.             {
  13.                 Background = _userStyles.BackgroundColor;
  14.                 Username = "";
  15.                 Password = "";
  16.                 IsVisible = false;
  17.             });
  18.         }, TaskScheduler.FromCurrentSynchronizationContext());
  19.     }
  20.  
  21.     if (!_hp.ValidatePassword(Password))
  22.     {
  23.         IsVisible = true;
  24.         Background = "#E2EB23";
  25.         ErrorText = "Invalid Username/Password Format. Try Again!";
  26.         Task.Delay(3000).ContinueWith((task) =>
  27.         {
  28.             Dispatcher.UIThread.Invoke(() =>
  29.             {
  30.                 Background = _userStyles.BackgroundColor;
  31.                 Username = "";
  32.                 Password = "";
  33.                 IsVisible = false;
  34.             });
  35.         });
  36.     }
  37.  
  38.     if (!_db.CheckForUser(Username))
  39.     {
  40.         IsVisible = true;
  41.         Background = "#E2EB23";
  42.         ErrorText = "Invalid Username/Password. Try Again!";
  43.  
  44.         Task.Delay(3000).ContinueWith((task) =>
  45.         {
  46.             Dispatcher.UIThread.Invoke(() =>
  47.             {
  48.                 Background = _userStyles.BackgroundColor;
  49.                 Username = "";
  50.                 Password = "";
  51.                 IsVisible = false;
  52.             });
  53.         });
  54.     }
  55.  
  56.     if (!_db.CheckForPassword(Username, Password))
  57.     {
  58.         IsVisible = true;
  59.         Background = "#E2EB23";
  60.         ErrorText = "Invalid Username/Password. Try Again!";
  61.  
  62.         Task.Delay(3000).ContinueWith((task) =>
  63.         {
  64.             Dispatcher.UIThread.Invoke(() =>
  65.             {
  66.                 Background = _userStyles.BackgroundColor;
  67.                 Username = "";
  68.                 Password = "";
  69.                 IsVisible = false;
  70.             });
  71.         });
  72.     }
  73.  
  74.     User returnUser = _db.GetUser(Username);
  75.  
  76.     return returnUser;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment