private static ReactiveCommand <Unit, Unit> RunScriptCommand(ScriptDeployer deployer, IFilePicker filePicker) { return(ReactiveCommand.CreateFromObservable(() => { var filter = new FileTypeFilter("Deployer Script", "*.ds", "*.txt"); return filePicker .Open("Select a script", new[] { filter }) .Where(x => x != null) .SelectMany(file => Observable.FromAsync(() => deployer.RunScript(file.Source.LocalPath))); })); }
public AdvancedViewModel(ScriptDeployer deployer, IDialogService dialogService, IFilePicker filePicker, OperationProgressViewModel operationProgress) { this.deployer = deployer; this.dialogService = dialogService; this.filePicker = filePicker; OperationProgress = operationProgress; ConfigureCommands(); IsBusyObservable = RunScript.IsExecuting; }