AuthViewModel.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using ReactiveUI;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Reactive;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace AvaloniaApplication4.ViewModels
  9. {
  10. internal class AuthViewModel
  11. {
  12. public class LoginViewModel : ViewModelBase
  13. {
  14. private string _username;
  15. private string _password;
  16. public string Username
  17. {
  18. get => _username;
  19. set => this.RaiseAndSetIfChanged(ref _username, value);
  20. }
  21. public string Password
  22. {
  23. get => _password;
  24. set => this.RaiseAndSetIfChanged(ref _password, value);
  25. }
  26. public ReactiveCommand<Unit, Unit> LoginCommand { get; }
  27. public LoginViewModel()
  28. {
  29. LoginCommand = ReactiveCommand.Create(Login);
  30. }
  31. private void Login()
  32. {
  33. // Реализуйте здесь логику авторизации
  34. Console.WriteLine($"Logging in: Username - {_username}, Password - {_password}");
  35. }
  36. }
  37. }
  38. }