Пример #1
0
        public static IGetOnlyProperty <TResult> SelectToGetOnly <TSource, TResult>(this ISettableProperty <TSource> source, Func <TSource, TResult> selector, bool notifiesUnchanged)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }

            return(new FollowingGetOnlyProperty <TResult>(source.Select(selector), selector(source.Value), notifiesUnchanged));
        }
Пример #2
0
        public AsyncKinectManager()
        {
            _Sensor = ObservableProperty.CreateSettable <KinectSensor>(null);
            Sensor  = _Sensor.ToGetOnlyMask();

            SensorDisconnected = _Sensor
                                 .Select(s => _sensorCache)
                                 .Where(s => s != null)
                                 .ToGetOnly(null, true);
            SensorConnected = _Sensor
                              .Do(s => _sensorCache = s)
                              .Where(s => s != null)
                              .ToGetOnly(null, true);
        }
Пример #3
0
        public AppModel()
        {
            Position = ObservableProperty.CreateSettable(new Point());

            var client = EventHubClient.Create("sakapon-event-201508");

            var index = 0;

            Position
            .Select(p => new { index = index++, position = p.ToString() })
            .Select(o => JsonConvert.SerializeObject(o))
            .Do(m => Debug.WriteLine("Sending message. {0}", new[] { m }))
            .Select(m => new EventData(Encoding.UTF8.GetBytes(m)))
            .Subscribe(d => client.SendAsync(d));
        }