MainWindowViewModel.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using Avalonia.Controls;
  2. using Avalonia.Media;
  3. using LoginGenerator.Models;
  4. using ReactiveUI;
  5. using System;
  6. using System.IO;
  7. using System.Linq;
  8. namespace LoginGenerator.ViewModels
  9. {
  10. public class MainWindowViewModel : ViewModelBase
  11. {
  12. UserControl us = new GeneratePage();
  13. public UserControl US
  14. {
  15. get => us;
  16. set => this.RaiseAndSetIfChanged(ref us, value);
  17. }
  18. DataOutputViewModel dataOutput = new DataOutputViewModel();
  19. public DataOutputViewModel DataOutputVM
  20. {
  21. get => dataOutput;
  22. set => dataOutput = value;
  23. }
  24. GeneratePageViewModel generatePage = new GeneratePageViewModel();
  25. public GeneratePageViewModel GeneratePageVM
  26. {
  27. get => generatePage;
  28. set => generatePage = value;
  29. }
  30. public void ViewUsersData()
  31. {
  32. US = new DataOutput();
  33. DataOutputVM.FillingUsersList();
  34. DataOutputVM.Userss = DataOutputVM.Userss.OrderByDescending(x=>x.DateReg).ToList();
  35. if(GeneratePageVM.Theme == true)
  36. {
  37. DataOutputVM.Background = new SolidColorBrush(Color.FromRgb(80, 80, 80));
  38. DataOutputVM.Background2 = new SolidColorBrush(Color.FromRgb(128, 128, 128));
  39. }
  40. else
  41. {
  42. DataOutputVM.Background = new SolidColorBrush(Color.FromRgb(248, 244, 255));
  43. DataOutputVM.Background2 = new SolidColorBrush(Color.FromRgb(236, 233, 255));
  44. }
  45. }
  46. public void ViewGeneratePage()
  47. {
  48. US = new GeneratePage();
  49. }
  50. }
  51. }