AdminViewModel.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using Avalonia.Controls;
  4. using Microsoft.EntityFrameworkCore.Metadata.Internal;
  5. using ReactiveUI;
  6. namespace AvaloniaApplication1.ViewModels
  7. {
  8. public class AdminViewModel : ViewModelBase
  9. {
  10. UserControl page = new MainPage();
  11. bool flag = false;
  12. List<string> pages = ["Ñìåøàðèêè","Ïðîôèëü","Äîáàâèòü ñìåøàðèêà"];
  13. string selectedItem;
  14. public UserControl Page { get => page; set => this.RaiseAndSetIfChanged(ref page, value); }
  15. public List<string> Pages { get => pages; set => this.RaiseAndSetIfChanged(ref pages, value); }
  16. public string SelectedItem { get => selectedItem; set { selectedItem = value; navigation(); } }
  17. public bool Flag { get => flag; set => this.RaiseAndSetIfChanged(ref flag, value); }
  18. public void navigation()
  19. {
  20. if(selectedItem == "Ñìåøàðèêè")
  21. {
  22. Page = new MainPage();
  23. }else if(selectedItem == "Ïðîôèëü")
  24. {
  25. Page = new AdminUsers();
  26. }else if(selectedItem == "Äîáàâèòü ñìåøàðèêà")
  27. {
  28. Page = new AddSmesh();
  29. }
  30. }
  31. public void Press()
  32. {
  33. Flag = !Flag;
  34. }
  35. }
  36. }