public ProjectsPageViewModel( IProjectsService projectsService, IProjectNavigationService projectNavigationService, ILoggerService loggerService) { _projectsService = projectsService; _projectNavigationService = projectNavigationService; _loggerService = loggerService; AddCommand = ReactiveCommand.CreateFromTask(AddHandler); DeleteCommand = ReactiveCommand.CreateFromTask <ProjectViewModel>(DeleteHandlerAsync); ViewCommand = ReactiveCommand.CreateFromTask <ProjectViewModel>(ViewHandlerAsync); }
public NewProjectViewModel( IProjectsService projectsService, IProjectNavigationService navigationService) { _projectsService = projectsService; _navigationService = navigationService; var canAdd = this.WhenAnyValue(x => x.Name) .Select((arg) => !string.IsNullOrWhiteSpace(arg)); AddProjectCommand = ReactiveCommand.CreateFromTask(AddProjectHandlerAsync, canAdd); }