public AddMultipleUserManagerUsersViewModel(IUserManagerClient userManagerClient, IEventAggregator eventAggregator) { Height = 560; CurrentViewIndex = 0; UsernameAndPasswordViewModel = new AddMultipleUsersUsernameAndPasswordViewModel(); ProfileAndOwnerViewModel = new AddMultipleUserManagerUsersProfileAndOwnerViewModel(userManagerClient); ((DelegateCommand)UsernameAndPasswordViewModel.NextCommand).RaiseCanExecuteChanged(); #region Init Cmmands // Init the next command of the first view UsernameAndPasswordViewModel.NextCommand = new DelegateCommand(() => { Height = 400; CurrentViewIndex = 1; }, () => UsernameAndPasswordViewModel.CanNavigate); // init the finish command of the second view ProfileAndOwnerViewModel.FinishCommand = new DelegateCommand(() => { eventAggregator.GetEvent <AddMultipleUserManagerUsersEvent>().Publish(this); DialogHost.CloseDialogCommand.Execute(null, null); }, () => ProfileAndOwnerViewModel.SelectedCustomerIndex > -1 && (!ProfileAndOwnerViewModel.ActivateUserNow || ProfileAndOwnerViewModel.SelectedProfileIndex > -1)); #endregion }
/// <summary> /// Default constructor /// </summary> /// <param name="eventAggregator"></param> /// <param name="hotspotClient"></param> public AddMultipleHotspotUsersViewModel(IEventAggregator eventAggregator, IHotspotClient hotspotClient) { UsernameAndPasswordViewModel = new AddMultipleUsersUsernameAndPasswordViewModel(); ProfileAndLimitsViewModel = new AddMultipleHotspotUsersProfileAndLimitsViewModel(); ((DelegateCommand)UsernameAndPasswordViewModel.NextCommand).RaiseCanExecuteChanged(); ProfileAndLimitsViewModel.FinishCommand = new DelegateCommand(() => { eventAggregator.GetEvent <AddMultipleHotspotUsersEvent>().Publish(this); DialogHost.CloseDialogCommand.Execute(null, null); }); ProfileAndLimitsViewModel.RefreshProfilesCommand = new DelegateCommand(async() => ProfileAndLimitsViewModel.Profiles = (await hotspotClient.LoadAllProfilesAsync()).Select(p => p.Name)); ProfileAndLimitsViewModel.RefreshProfilesCommand.Execute(null); }