RxCommandSync<TParam, TResult> constructor

RxCommandSync<TParam, TResult>(Func1<TParam, TResult> func, [ Observable<bool> canExecute ])

Implementation

RxCommandSync(Func1<TParam, TResult> func, [Observable<bool> canExecute] )
{

  var canExecuteParam = canExecute == null ? new Observable.just(true)
                                            : canExecute.handleError((error)
                                              {
                                                  if (error is Exception)
                                                  {
                                                    _thrownExceptionsSubject.add(error);
                                                  }
                                              })
                                              .distinct();



canExecuteParam.listen((canExecute){
  _canExecute = canExecute && (!_isRunning);
  _canExecuteSubject.add(_canExecute);
});



  _func = func;



}