YourProfileCod.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Rkis29.ViewModel;
  7. using Rkis29.Windows;
  8. using Rkis29.Command;
  9. using System.Collections.ObjectModel;
  10. namespace Rkis29.Command
  11. {
  12. internal class YourProfileCod : BaseViewModel
  13. {
  14. private RelayCommand _totasks;
  15. private ObservableCollection<User> _users;
  16. private User _user;
  17. public string _YourFCs;
  18. private string _YourLogin;
  19. private string _YourPhon;
  20. public RelayCommand ToTasks
  21. {
  22. get
  23. {
  24. return _totasks ??
  25. (_totasks = new RelayCommand((x) =>
  26. {
  27. Tasks taskWindow = new Tasks();
  28. taskWindow.Show();
  29. foreach (var window in App.Current.Windows)
  30. {
  31. if (window is YourProfile mainWindow)
  32. {
  33. mainWindow.Close();
  34. }
  35. }
  36. }));
  37. }
  38. }
  39. public string YourFCs
  40. {
  41. get => _YourFCs = User.AutoUser.FirstName + " " + User.AutoUser.Name + " " + User.AutoUser.LastName;
  42. }
  43. public string YourLogin
  44. {
  45. get => _YourLogin = User.AutoUser.Login;//AutoUser - переменная, которая хранит значения авторизованного пользователя
  46. }
  47. public string YourPhon
  48. {
  49. get => _YourPhon = User.AutoUser.PhonNum;
  50. }
  51. public ObservableCollection<User> Users
  52. {
  53. get => _users;
  54. set
  55. {
  56. _users = value;
  57. OnPropertyChanged();
  58. }
  59. }
  60. public User User
  61. {
  62. get => _user;
  63. set
  64. {
  65. _user = value;
  66. OnPropertyChanged();
  67. }
  68. }
  69. public YourProfileCod()
  70. {
  71. loferlContext loferlcontext = new loferlContext();
  72. _users = new ObservableCollection<User>(loferlcontext.Users);
  73. _user = new User();
  74. }
  75. }
  76. }