public GroupViewModel(IFaceServiceClient client, IDialogService dialogService) { this.client = client; var fileSelector = new ObservableFileSelector(); var imageSelector = new ImageSelector(fileSelector.SelectFilesCommand); faceDetector = new Detector(client); SelectFilesCommand = fileSelector.SelectFilesCommand; var selectFilesObs = SelectFilesCommand.Publish(); GroupCommand = ReactiveCommand.CreateFromTask(GroupImages, imageSelector.Images.Any()); GroupCommand.ThrownExceptions.Subscribe(async exception => await dialogService.ShowException(exception)); imagesHelper = imageSelector.Images.ToProperty(this, model => model.Images); groupsHelper = GroupCommand.ToProperty(this, model => model.Groups); loadingHelper = GroupCommand.IsExecuting.ToProperty(this, model => model.IsBusy); selectFilesObs.Connect(); }