MainWindowViewModel.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using Avalonia.Controls;
  2. using ReactiveUI;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using travel.Models;
  7. using travel.ViewModels;
  8. using travel.Views;
  9. namespace travel.ViewModels
  10. {
  11. public class MainWindowViewModel : ViewModelBase
  12. {
  13. public static UpShechkovaContext myConnection = new UpShechkovaContext();
  14. UserControl us = new ToursPage();
  15. public UserControl US { get => us; set => this.RaiseAndSetIfChanged(ref us, value); }
  16. ToursPageViewModel tPVMl1VM = new();
  17. public ToursPageViewModel TP_VM { get => tPVMl1VM; set => tPVMl1VM = value; }
  18. HotelPageViewModel hpVM = new HotelPageViewModel();
  19. public HotelPageViewModel hp_VM { get => hpVM; set => hpVM = value; }
  20. HotelCardViewModel hcVM = new HotelCardViewModel();
  21. public HotelCardViewModel hc_VM { get => hcVM; set => hcVM = value; }
  22. public void GoPageHotel()
  23. {
  24. hp_VM = new HotelPageViewModel();
  25. US = new HotelPage();
  26. }
  27. public void GoPageTour()
  28. {
  29. TP_VM = new ToursPageViewModel();
  30. US = new ToursPage();
  31. }
  32. public void GoHotelCard()
  33. {
  34. hc_VM = new HotelCardViewModel();
  35. US = new HotelCard();
  36. }
  37. public void GoHotelCardChange(int ID)
  38. {
  39. hc_VM = new HotelCardViewModel(ID);
  40. US = new HotelCard();
  41. }
  42. }
  43. }