1234567891011121314151617181920212223242526272829303132333435363738 |
- using Avalonia.Controls;
- using ReactiveUI;
- namespace Prak12.ViewModels
- {
- public class MainWindowViewModel : ViewModelBase
- {
- public MainWindowViewModel()
- {
- ShowTeachersViewModel stvm = new ShowTeachersViewModel();
- stvm.ButtonAddNewTeacherWasPressed += ButtonAddNewTeacherWasPressed;
- UserControl = (new ViewLocator()).Build(stvm);
- }
- private void ButtonAddNewTeacherWasPressed()
- {
- AddTeachersViewModel atvm = new AddTeachersViewModel();
- atvm.AddNewTeacherPageWasClosed += AddNewTeacherPageWasClosed;
- UserControl = (new ViewLocator()).Build(atvm);
- }
- private void AddNewTeacherPageWasClosed()
- {
- ShowTeachersViewModel stvm = new ShowTeachersViewModel();
- stvm.ButtonAddNewTeacherWasPressed += ButtonAddNewTeacherWasPressed;
- UserControl = (new ViewLocator()).Build(stvm);
- }
- public Control UserControl
- {
- get => _userControl;
- set => this.RaiseAndSetIfChanged(ref _userControl, value);
- }
- private Control _userControl;
- }
- }
|