CreateProfileViewModel.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using HelloItQuantum.Function;
  4. using HelloItQuantum.Models;
  5. using HelloItQuantum.Views;
  6. using ReactiveUI;
  7. namespace HelloItQuantum.ViewModels
  8. {
  9. public class CreateProfileViewModel : MainWindowViewModel
  10. {
  11. #region
  12. string nickname = "";
  13. string name = "";
  14. string surname = "";
  15. public string Nickname { get => nickname; set => SetProperty(ref nickname, value); }
  16. public string Name { get => name; set => SetProperty(ref name, value); }
  17. public string Surname { get => surname; set => SetProperty(ref surname, value); }
  18. #endregion
  19. /// <summary>
  20. /// Ìåòîä, îáðàáàòûâàþùèé íàæàòèå íà êíîïêó Ñîçäàòü ïðîôèëü
  21. /// </summary>
  22. public void CreateProfile()
  23. {
  24. var newUser = new User();
  25. newUser.Nickname = Nickname;
  26. newUser.Name = Name;
  27. newUser.Surname = Name;
  28. newUser.GameHotkeys = 0;
  29. newUser.GameCreateFriend = 0;
  30. newUser.GameLabyrinth = 0;
  31. if (WorkWithFile.IsWriteUserInFile(newUser))
  32. {
  33. AuthVM = new AuthViewModel();
  34. PageSwitch.View = new AuthView();
  35. }
  36. else
  37. {
  38. //Òåõíè÷åñêèå øîêîëàäêè
  39. }
  40. }
  41. /// <summary>
  42. /// Ìåòîä, îáðàáàòûâàþùèé íàæàòèå íà êíîïêó Åñòü ïðîôèëü
  43. /// </summary>
  44. public void Auth()
  45. {
  46. AuthVM = new AuthViewModel();
  47. PageSwitch.View = new AuthView();
  48. }
  49. }
  50. }