예제 #1
0
        private void SanitizeTypes()
        {
            bool didTypeChange = false;

            if (bindingType == BindingType.Variable && fromBinding.Type != typeof(IReadOnlyObservableVariable <TFrom>))
            {
                fromBinding   = new BindingInfo(typeof(IReadOnlyObservableVariable <TFrom>));
                expectedType  = new SerializableType(typeof(OperatorVariableViewModel <TTo>));
                didTypeChange = true;
            }

            if (bindingType == BindingType.Collection && fromBinding.Type != typeof(IReadOnlyObservableCollection <TFrom>))
            {
                fromBinding   = new BindingInfo(typeof(IReadOnlyObservableCollection <TFrom>));
                expectedType  = new SerializableType(typeof(OperatorCollectionViewModel <TTo>));
                didTypeChange = true;
            }

            if (bindingType == BindingType.Command && fromBinding.Type != typeof(IObservableCommand <TTo>))
            {
                fromBinding   = new BindingInfo(typeof(IObservableCommand <TTo>));
                expectedType  = new SerializableType(typeof(OperatorCommandViewModel <TFrom>));
                didTypeChange = true;
            }

            if (bindingType == BindingType.Event && fromBinding.Type != typeof(IObservableEvent <TFrom>))
            {
                fromBinding   = new BindingInfo(typeof(IObservableEvent <TFrom>));
                expectedType  = new SerializableType(typeof(OperatorEventViewModel <TTo>));
                didTypeChange = true;
            }

            if (didTypeChange)
            {
                BindingInfoTrackerProxy.RefreshBindingInfo();
            }
        }
예제 #2
0
 public SkipCommandBindingProcessor(BindingInfo bindingInfo, Component context, int skipAmount)
     : base(bindingInfo, context)
 {
     this.skipAmount    = skipAmount;
     valueReceivedCount = 0;
 }
예제 #3
0
        protected override IBindingProcessor GetBindingProcessor(BindingType bindingType, BindingInfo fromBinding)
        {
            IBindingProcessor result = null;

            switch (bindingType)
            {
            case BindingType.Variable:
                result = new TakeVariableBindingProcessor <T>(fromBinding, this, skipAmount);
                break;

            case BindingType.Collection:
                Debug.LogError("Collection take is not supported", this);
                break;

            case BindingType.Command:
                result = new TakeCommandBindingProcessor <T>(fromBinding, this, skipAmount);
                break;

            case BindingType.Event:
                result = new TakeEventBindingProcessor <T>(fromBinding, this, skipAmount);
                break;
            }

            return(result);
        }
예제 #4
0
        protected override IBindingProcessor GetBindingProcessor(BindingType bindingType, BindingInfo fromBinding)
        {
            IBindingProcessor result = null;

            switch (bindingType)
            {
            case BindingType.Variable:
                result = new TweenVariableBindingProcessor <T>(fromBinding, this, BuildTweener);
                break;

            case BindingType.Collection:
                result = new TweenCollectionBindingProcessor <T>(fromBinding, this, BuildTweener);
                break;
            }

            return(result);
        }
예제 #5
0
 public VariableBinding(BindingInfo bindingInfo, Component context) : base(bindingInfo, context)
 {
     exposedProperty = new ObservableVariable <T>();
 }
예제 #6
0
 public TweenVariableBindingProcessor(BindingInfo bindingInfo, Component context, BuildTweener tweenBuilder)
     : base(bindingInfo, context)
 {
     this.tweenBuilder = tweenBuilder;
 }
예제 #7
0
 protected CollectionBindingSubscriber <T> RegisterCollection <T>(BindingInfo bindingInfo)
 {
     return(bindingTracker.RegisterCollection <T>(bindingInfo));
 }
예제 #8
0
 public DelayVariableBindingProcessor(BindingInfo bindingInfo, Component context, float delay)
     : base(bindingInfo, context)
 {
     actionQueue = new Queue <ActionCommand>();
     this.delay  = delay;
 }
예제 #9
0
        protected override IBindingProcessor GetBindingProcessor(BindingType bindingType, BindingInfo fromBinding)
        {
            IBindingProcessor result = null;

            switch (bindingType)
            {
            case BindingType.Variable:
                result = new DelayVariableBindingProcessor <T>(fromBinding, this, delay);
                break;

            case BindingType.Collection:
                result = new DelayCollectionBindingProcessor <T>(fromBinding, this, delay);
                break;

            case BindingType.Command:
                result = new DelayCommandBindingProcessor <T>(fromBinding, this, delay);
                break;

            case BindingType.Event:
                result = new DelayEventBindingProcessor <T>(fromBinding, this, delay);
                break;
            }

            return(result);
        }
예제 #10
0
 public CollectionBinding(BindingInfo bindingInfo, Component context) : base(bindingInfo, context)
 {
     exposedProperty = new ObservableCollection <T>();
 }
예제 #11
0
 protected abstract IBindingProcessor GetBindingProcessor(BindingType bindingType, BindingInfo fromBinding);
예제 #12
0
 protected CommandBindingSubscriber <T> RegisterCommand <T>(BindingInfo bindingInfo)
 {
     return(bindingTracker.RegisterCommand <T>(bindingInfo));
 }
예제 #13
0
 protected EventBindingSubscriber <T> RegisterEvent <T>(BindingInfo bindingInfo)
 {
     return(bindingTracker.RegisterEvent <T>(bindingInfo));
 }
예제 #14
0
 public ToEventBindingProcessor(BindingInfo bindingInfo, Component context, Func <TFrom, TTo> processFunction)
     : base(bindingInfo, context)
 {
     this.processFunction = processFunction;
 }
예제 #15
0
 public Binding(BindingInfo bindingInfo, Component context)
 {
     this.bindingInfo = bindingInfo;
     this.context     = context;
 }
예제 #16
0
 public EventBinding(BindingInfo bindingInfo, Component context) : base(bindingInfo, context)
 {
     exposedProperty = new ObservableEvent();
 }
예제 #17
0
 public TakeCommandBindingProcessor(BindingInfo bindingInfo, Component context, int takeAmount)
     : base(bindingInfo, context)
 {
     this.takeAmount    = takeAmount;
     valueReceivedCount = 0;
 }
예제 #18
0
 public CommandBinding(BindingInfo bindingInfo, Component context) : base(bindingInfo, context)
 {
     canExecuteSource = new ObservableVariable <bool>(false);
     exposedProperty  = new ObservableCommand(canExecuteSource, OnExecuteRequested);
 }
예제 #19
0
 protected VariableBindingSubscriber <T> RegisterVariable <T>(BindingInfo bindingInfo)
 {
     return(bindingTracker.RegisterVariable <T>(bindingInfo));
 }