mekasu0124

Untitled

Mar 16th, 2024
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. public LoginViewModel()
  2. {
  3.     Ok = ReactiveCommand.Create(ReturnUser, isEnabled);
  4.     Cancel = ReactiveCommand.Create(ExitProgram, isEnabled);
  5.     ReturnCreateNewUser = ReactiveCommand.Create(CreateNewUser, isEnabled);
  6.     ForgotPassword = ReactiveCommand.Create(ReturnForgotPassword, isEnabled);
  7. }
  8.  
  9. internal static void ExitProgram() => Environment.Exit(0);
  10.  
  11. internal static void ReturnForgotPassword()
  12. {
  13.     MainWindowViewModel mainWindow = new();
  14.     mainWindow.ShowForgotPassword();
  15. }
  16.  
  17. internal static void CreateNewUser()
  18. {
  19.     MainWindowViewModel mainWindow = new();
  20.     mainWindow.CreateNewUser();
  21. }
  22.  
  23. public UserModel ReturnUser()
  24. {
  25.     NewUser.Username = Username;
  26.     NewUser.Password = Password;
  27.  
  28.     bool canReturn = RunChecks();
  29.  
  30.     if (canReturn)
  31.     {
  32.         return NewUser;
  33.     }
  34.  
  35.     return new UserModel();
  36. }
  37. public ReactiveCommand<Unit, UserModel> Ok { get; }
  38. public ReactiveCommand<Unit, Unit> Cancel { get; }
  39. public ReactiveCommand<Unit, Unit> ReturnCreateNewUser { get; }
  40.  
  41. public ReactiveCommand<Unit, Unit> ForgotPassword { get; }
Advertisement
Add Comment
Please, Sign In to add comment