Example #1
0
 public static IReactiveBinding <TView, TProp> BindCommand <TView, TViewModel, TProp, TControl>(
     this ICommandBinderImplementation @this,
     TViewModel?viewModel,
     TView view,
     Expression <Func <TViewModel, TProp?> > propertyName,
     Expression <Func <TView, TControl> > controlName,
     string?toEvent = null)
     where TView : class, IViewFor <TViewModel>
     where TViewModel : class
     where TProp : ICommand =>
 @this.BindCommand(viewModel, view, propertyName, controlName, Observable <object> .Empty, toEvent);
Example #2
0
 public static IDisposable BindCommand <TView, TViewModel, TProp, TControl>(
     this ICommandBinderImplementation This,
     TViewModel viewModel,
     TView view,
     Expression <Func <TViewModel, TProp> > propertyName,
     Expression <Func <TView, TControl> > controlName,
     string toEvent = null)
     where TViewModel : class
     where TView : class, IViewFor <TViewModel>
     where TProp : ICommand
 {
     return(This.BindCommand(viewModel, view, propertyName, controlName, Observable.Empty <object>(), toEvent));
 }
Example #3
0
 public static IDisposable BindCommand <TView, TViewModel, TProp, TControl, TParam>(
     this ICommandBinderImplementation This,
     TViewModel viewModel,
     TView view,
     Expression <Func <TViewModel, TProp> > propertyName,
     Expression <Func <TView, TControl> > controlName,
     Expression <Func <TViewModel, TParam> > withParameter,
     string toEvent = null)
     where TViewModel : class
     where TView : class, IViewFor <TViewModel>
     where TProp : ICommand
 {
     return(This.BindCommand(viewModel, view, propertyName, controlName, view.ViewModel.WhenAny(withParameter, x => x.Value), toEvent));
 }
Example #4
0
        public static IReactiveBinding <TView, TViewModel, TProp> BindCommand <TView, TViewModel, TProp, TControl, TParam>(
            this ICommandBinderImplementation This,
            TViewModel viewModel,
            TView view,
            Expression <Func <TViewModel, TProp> > propertyName,
            Expression <Func <TView, TControl> > controlName,
            Expression <Func <TViewModel, TParam> > withParameter,
            string toEvent = null)
            where TViewModel : class
            where TView : class, IViewFor <TViewModel>
            where TProp : ICommand
        {
            var paramExpression = Reflection.Rewrite(withParameter.Body);
            var param           = Reflection.ViewModelWhenAnyValue(viewModel, view, paramExpression);

            return(This.BindCommand(viewModel, view, propertyName, controlName, param, toEvent));
        }
Example #5
0
 static CommandBinder()
 {
     binderImplementation = new CommandBinderImplementation();
 }
Example #6
0
 internal static void Initialize(ICommandBinderImplementation commandBinderImplementation)
 {
     _binderImplementation = commandBinderImplementation ?? throw new ArgumentNullException(nameof(commandBinderImplementation));
 }
Example #7
0
 static CommandBinder()
 {
     binderImplementation = RxApp.DependencyResolver.GetService <ICommandBinderImplementation>() ??
                            new CommandBinderImplementation();
 }