Пример #1
0
        public static IWritableRx <T> TwoWayBound <T, T0>(IWritableRx <T0> source, ITwoWayConverter <T, T0> converter, IEqualityComparer <T> equalityComparer = null)
        {
            IWritableRx <T> rx = new TwoWayBoundRx <T>(() => converter.Convert(source.Value), value => source.Value = converter.ConvertBack(value, source.Value), equalityComparer);

            source.Watch(rx.Update);

            return(rx);
        }
Пример #2
0
        public static IWritableRx <T> Watch <T>(this IWritableRx <T> rx, Action <IRx <T>, T> valueChanged)
        {
            rx.ValueChanged += (source, newValue, oldValue) => valueChanged(source, newValue);

            return(rx);
        }
Пример #3
0
        public static IWritableRx <T> Watch <T>(this IWritableRx <T> rx, RxValueChanged <T> valueChanged)
        {
            rx.ValueChanged += valueChanged;

            return(rx);
        }