private async Task ExecuteEditor(ReactiveEditCommand commandSpec) { var editor = commandSpec.CreateEditor(); try { Editing = Some(commandSpec.Editable); await editor.Edit(); } finally { Editing = None; } }
public IReactiveCommand Register(ReactiveEditCommand commandSpec, IScheduler scheduler) { var canExecute = this.WhenAnyValue(p => p.Editing) .CombineLatest(commandSpec.CanExecute, (a, b) => a.IsNone && b) .ObserveOn(scheduler); var command = ReactiveCommand.Create(canExecute); command .ObserveOn(commandSpec.EditorScheduler) .Subscribe(async _ => { try { await ExecuteEditor(commandSpec); } catch (Exception e) { e.Show(); } }); return command; }
public IReactiveCommand Register(ReactiveEditCommand commandSpec, IScheduler scheduler) { var canExecute = this.WhenAnyValue(p => p.Editing) .CombineLatest(commandSpec.CanExecute, (a, b) => a.IsNone && b) .ObserveOn(scheduler); var command = ReactiveCommand.Create(canExecute); command .ObserveOn(commandSpec.EditorScheduler) .Subscribe(async _ => { try { await ExecuteEditor(commandSpec); } catch (Exception e) { e.Show(); } }); return(command); }
public static IReactiveCommand RegisterWith(this ReactiveEditCommand command, ISerialCommandController serialCommandController, IScheduler schedular) { return(serialCommandController.Register(command, schedular)); }