Пример #1
0
        /// <summary>
        /// Based on a destination string provided by the view if a click event occurs
        /// this methode navigates to the appropriate view.
        /// </summary>
        /// <param name="destination"></param>
        public void Navigate(string destination)
        {
            switch (destination)
            {
            case "AdministrationExercises":
                CurrentViewModel = new ExerciseAdministrationViewModel();
                break;

            case "AdministrationExerciseCategories":
                CurrentViewModel = new ExerciseCategoryAdministrationViewModel();
                break;

            case "Information":
                CurrentViewModel = new InformationViewModel();
                break;

            case "Help":
                CurrentViewModel = new HelpViewModel();
                break;

            case "CloseSession":
                CurrentViewModel = new MainViewViewModel();
                break;

            case "CreateSession":
                CurrentViewModel = new SessionCreatorViewModel();
                break;

            default:
                CurrentViewModel = new MainViewViewModel();
                break;
            }
        }
Пример #2
0
 /// <summary>
 /// The constructor creates a new instance of the
 /// current ViewModel.
 /// </summary>
 public MainWindowViewModel()
 {
     //when starting the app set the CurrentViewModel so the screen is not empty
     CurrentViewModel = new MainViewViewModel();
     //initialize the RelayCommand to allow the user to navigate to a different view
     NavCommand = new RelayCommand <string>(Navigate);
 }