Exemplo n.º 1
0
        protected override IObservable <float> CreateObservable(IAttributeHolder holder)
        {
            Ensure.That(holder, nameof(holder)).IsNotNull();

            var source = _value
                         .SelectMany(identity)
                         .WithLatestFrom(OnModifierChange, (v, m) => v * m)
                         .WithLatestFrom(OnRangeChange, (value, range) => (value, range));

            return(source
                   .Scan(0f, (sum, v) => v.range.Clamp(sum + v.value))
                   .CombineLatest(OnRangeChange, (v, r) => r.Clamp(v)));
        }
Exemplo n.º 2
0
        private IDisposable ShouldRetrieveFaceWhenActivatedAndAfterRecognition()
        {
            //return ObservableExtensions
            //    .UsingAsync(
            //        () => _dataProvider.UnrecognisedBy(_userId, page => 1).GetAsyncEnumerator(),
            //        enumerator => _recognised
            //            .SelectMany(_ => GetFaceAsync(enumerator))
            //            .TakeWhile(tuple => tuple.Item1)
            //            .Select(tuple => tuple.Item2))
            //    .ObserveOn(_schedulers.Dispatcher)
            //    .Subscribe(_face);

            return(_recognised
                   .SelectMany(_ => _dataProvider.UnrecognisedBy(_userId))
                   .Do(face => _logger.LogInformation($"Unrecognised: {face.Id} @ {face.Uri}"))
                   .ObserveOn(_schedulers.Dispatcher)
                   .Subscribe(_face));
        }