MainWindowViewModel.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using Avalonia.Controls;
  2. using ReactiveUI;
  3. using scool.Models;
  4. using scool.Views;
  5. namespace scool.ViewModels
  6. {
  7. public class MainWindowViewModel : ViewModelBase
  8. {
  9. public static _43pErmolinContext connect = new _43pErmolinContext();
  10. UserControl us = new DataTeachers();
  11. public UserControl US
  12. {
  13. get => us;
  14. set => this.RaiseAndSetIfChanged(ref us, value);
  15. }
  16. DataTeachersViewModel dataTeachersViewModel = new DataTeachersViewModel();
  17. AddTeacherViewModel addTeacherViewModel = new AddTeacherViewModel();
  18. public DataTeachersViewModel DataTeachersVM
  19. {
  20. get => dataTeachersViewModel;
  21. set => dataTeachersViewModel = value;
  22. }
  23. public AddTeacherViewModel AddTeacherVM
  24. {
  25. get => addTeacherViewModel;
  26. set => addTeacherViewModel = value;
  27. }
  28. public void ToAdd()
  29. {
  30. US = new AddTeacher();
  31. }
  32. public void ToData()
  33. {
  34. US = new DataTeachers();
  35. }
  36. }
  37. }