public ComposerViewModel(string title, Func <string, Task> saveFunc, IAlertDialogFactory alertDialogFactory) { Title = title; SaveCommand = ReactiveCommand.CreateAsyncTask( this.WhenAnyValue(x => x.Text).Select(x => !string.IsNullOrEmpty(x)), t => saveFunc(Text)); SaveCommand.AlertExecuting(alertDialogFactory, "Saving..."); SaveCommand.Subscribe(x => Dismiss()); DismissCommand = ReactiveCommand.CreateAsyncTask(async t => { if (string.IsNullOrEmpty(Text)) { return(true); } return(await alertDialogFactory.PromptYesNo("Discard Comment?", "Are you sure you want to discard this comment?")); }); DismissCommand.Where(x => x).Subscribe(_ => Dismiss()); }