private ReactiveCommand CreateNavigateToDealCommand(IObservable <bool> canExecuteObservable = null) { var command = new ReactiveCommand(canExecuteObservable); command.IsExecuting.Subscribe(isBusy => IsBusy = isBusy); command.Subscribe( _ => { var viewModel = _routableViewModelManager.Get <IDummyViewModel>(); viewModel.CertificateQuality = SelectedCertificateQuality; HostScreen.Router.Navigate.Execute(viewModel); }); return(command); }
public EditablePersonalAccountViewModel( IScreen screen, IMessageBus messageBus, IUnitOfWorkFactory unitOfWork, IFilterViewModelFactory filterViewModelFactory, IRoutableViewModelManager routableViewModelManager, IValidatorFactory validatorFactory) : base(screen, messageBus, validatorFactory) { _filterViewModelFactory = filterViewModelFactory; _unitOfWorkFactory = unitOfWork; PersonalAccountFilterViewModel = _filterViewModelFactory.Create <PersonalAccountFilter, PersonalAccountDto>(); ContractViewModel = routableViewModelManager.Get <IContractViewModel>(); this.WhenAny(x => x.UserContractor, x => x.Value) .Where(x => x != null) .Subscribe(x => { ContractViewModel.ContractFilterViewModel.SetFilter(new ContractFilter { Contaractor = x, State = ContractStatusState.Approved }); ContractViewModel.StagesOfTheContractFilterViewModel.SetFilter(new StagesOfTheContractFilter { State = StageStatusState.Open }); ContractViewModel.ContractFilterViewModel.InvokeCommand.Execute(null); }); }
public MainPageViewModel( IBarcodeReader barcodeReader, IRoutableViewModelManager routableViewModelManager, IScreen hostScreen, IMessageBus messageBus, ITitleBarHostScreen titleBarHostScreen) { HostScreen = hostScreen; _barcodeReader = barcodeReader; _messageBus = messageBus; _barcodeReader.EnteredBarcode += BarcodeReaderEnteredBarcode; _barcodeReader.Start(); HostScreen.Router.Navigate.Execute(routableViewModelManager.Get <ISwitcherViewModel>()); titleBarHostScreen.Router.Navigate.Execute(routableViewModelManager.Get <ITitleBarViewModel>()); }
private void OnNavigate(Type resolveType) { Contract.Requires(resolveType != null, "The resolve type must be defined"); var vm = _viewModelManager.Get(resolveType); HostScreen.Router.Navigate.Execute(vm); }
private ReactiveCommand GetCommandEditPermisionMaterial(EditState editState, IObservable <bool> canExecute = null) { var command = new ReactiveCommand(canExecute); command.RegisterAsyncFunction( _ => new { PermissionMaterial = PreparingForEditablePermissionMaterial(editState), EditState = editState }) .Subscribe( result => { var viewModel = _routableViewModelManager.Get <IEditablePermissionMaterialViewModel>(); viewModel.SetEditableObject(result.PermissionMaterial, result.EditState); HostScreen.Router.Navigate.Execute(viewModel); }); command.IsExecuting.Subscribe(isExecuting => IsBusy = isExecuting); return(command); }
private ReactiveCommand GetCommandEditableActSelectionOfProbe(EditState editState, IObservable <bool> canExecute) { var command = new ReactiveCommand(canExecute); command.RegisterAsyncFunction(o => { Filter.SetFilter(new CertificateQualityFilter { Rn = SelectedActSelectionOfProbe.RnCertificate }).Wait(); return(GetActSelectionOfProbe(editState)); }).Subscribe( result => { var viewModel = _routableViewModelManager.Get <IEditableActSelectionOfProbeViewModel>(); viewModel.CertificateQuality = Filter.Result.FirstOrDefault(); viewModel.SetEditableObject(result, editState); HostScreen.Router.Navigate.Execute(viewModel); }); command.IsExecuting.Subscribe(isExecuting => IsBusy = isExecuting); return(command); }
private ReactiveCommand GetEditCommand(EditState editState, IObservable <bool> canExecute = null) { var command = new ReactiveCommand(canExecute ?? this.WhenAny(x => x.IsBusy, x => !x.Value)); command.RegisterAsyncFunction( _ => { var departmentOrder = PreparingEditableDepartmentOrder(editState); var viewModel = _routableViewModelManager.Get <IEditDepartmentOrderViewModel>(); viewModel.SetEditableObject(departmentOrder, editState); return(viewModel); }).Subscribe(viewModel => this.HostScreen.Router.Navigate.Execute(viewModel)); command.IsExecuting.Subscribe(isExecuting => IsBusy = isExecuting); return(command); }
private ReactiveCommand GetCommandEditablePlanCertificate(EditState editState, IObservable <bool> canExecute = null) { var command = new ReactiveCommand(canExecute); command.RegisterAsyncFunction( _ => { var result = PreparingEditablePlanCertificate(editState); var viewModel = _routableViewModelManager.Get <IEditablePlanCertificateViewModel>(); if (editState == EditState.Clone) { var obj = result.ClearValues(); viewModel.SetEditableObject(obj, editState); } if (editState == EditState.Edit) { viewModel.SetEditableObject(result, editState); } if (editState == EditState.Insert) { result.CertificateQuality.CreatorFactory = new User(SelectedPlanReceiptOrder.RnContractor) { OrganizationName = SelectedPlanReceiptOrder.Contractor }; viewModel.SetEditableObject(result, editState); } Task task = _initializationManager.InitViewModel(viewModel); task.Wait(); return(viewModel); }) .ObserveOnUiSafeScheduler() .Subscribe(viewModel => this.HostScreen.Router.Navigate.Execute(viewModel)); command.ThrownExceptions.Subscribe(this.OnError); command.IsExecuting.Subscribe(isExecuting => IsBusy = isExecuting); return(command); }
private void StartWindowLoaded(object sender, RoutedEventArgs e) { Loaded -= StartWindowLoaded; OwnerHostScreen.Router.NavigateAndReset.Execute(_routableViewModelManager.Get <ILoginViewModel>()); }