//Overloaded Constructor //It has a reference to the main VM that helps to navigate to the desired views public TodayActivityViewModel(MainViewModel mwVM) { GetTodayEvents(); GetTodayTasks(); MainVM = mwVM; DisplayActivityCommand = new ViewSwitchCommand(SwitchViewAndSeeSelectedActivity); //Calling the method to navidate to the Contact view IgnoreCommand = new ViewSwitchCommand(() => { MainVM.DisplayContactView(); }); }
//Constructor public MainViewModel() { ContactVM = new ContactsViewModel(); EventsVM = new EventsViewModel(); ToDoListVM = new ToDoListViewModel(); TodayActivityVM = new TodayActivityViewModel(this); CurrentView = TodayActivityVM; ContactsViewSwitchCommand = new ViewSwitchCommand(DisplayContactView); EventsViewSwitchCommand = new ViewSwitchCommand(DisplayEventsView); ToDoListViewSwitchCommand = new ViewSwitchCommand(DisplayToDoListtView); }