public UserPage() { InitializeComponent(); if (DesignerProperties.GetIsInDesignMode(this)) { // Create new instance of settings view model DataContext = new UserPageViewModels(); } else { DataContext = IoC.UserView; } }
public ApplicationViewModel() { HomeVM = new HomeViewModel(); LoginVM = new LoginViewModel(); AboutVM = new AboutViewModel(); LoggedInVM = new LoggedInViewModel(); WorkoutVM = new WorkoutViewModel(); // Add available pages PageViewModels.Add(HomeVM); PageViewModels.Add(AboutVM); // Add user pages - displayed when logged on UserPageViewModels.Add(WorkoutVM); ProfileInfoVM = new ProfileInfoViewModel(); ProgressVM = new ProgressViewModel(); ChartsVM = new ChartsViewModel(); UserPageViewModels.Add(ProfileInfoVM); UserPageViewModels.Add(ProgressVM); UserPageViewModels.Add(ChartsVM); // Set starting page OverlayViewModel = LoginVM; CurrentPageViewModel = PageViewModels[0]; LoginUserCommand = new RelayCommand((p) => LoginUserTool(p)); CreateAccountViewCommand = new RelayCommand((p) => CreateAccountView()); ForgotPasswordViewCommand = new RelayCommand((p) => ForgotPasswordView()); EditDataCommand = new RelayCommand((p) => EditProfileData()); UpdateDataCommand = new RelayCommand((p) => UpdateProfileData()); EditRecordCommand = new RelayCommand((p) => EditRecord()); UpdateRecordCommand = new RelayCommand((p) => UpdateRecord()); AddRecordCommand = new RelayCommand((p) => AddRecord()); HomeVM.Visibility = Visibility.Visible; LoginVM.Visibility = Visibility.Visible; AboutVM.Visibility = Visibility.Visible; }