コード例 #1
0
 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);
 }
コード例 #2
0
        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);
        }