当前位置: 首页>>代码示例>>C#>>正文


C# IObservable.Buffer方法代码示例

本文整理汇总了C#中IObservable.Buffer方法的典型用法代码示例。如果您正苦于以下问题:C# IObservable.Buffer方法的具体用法?C# IObservable.Buffer怎么用?C# IObservable.Buffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IObservable的用法示例。


在下文中一共展示了IObservable.Buffer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Configure

 public IObservable<FileSystemChange> Configure(IObservable<FileSystemChange> observable)
 {
     // http://stackoverflow.com/questions/9985125/in-rx-how-to-group-latest-items-after-a-period-of-time
     return observable.Buffer(() => observable.Throttle(TimeSpan.FromSeconds(2)).Timeout(TimeSpan.FromMinutes(1)))
         .PrioritizeFileSystemChanges()
         .SelectMany(x => x);
 }
开发者ID:slashdotdash,项目名称:Duplicity,代码行数:7,代码来源:Configurator.cs

示例2: BulkTrigger

 /// <summary>
 /// Bulks the trigger.
 /// </summary>
 /// <param name="streamRate">The stream rate.</param>
 /// <param name="scheduler">The scheduler.</param>
 /// <returns></returns>
 public IObservable<Unit> BulkTrigger(
             IObservable<Unit> streamRate,
             IScheduler scheduler)
 {
     var result = streamRate.Buffer(3)
         .Select(_ => Unit.Default);
     return result;
 }
开发者ID:bnayae,项目名称:VisualRx.DeleteCandidate,代码行数:14,代码来源:TestVisualRxChannel.cs

示例3: ObserveScenarioOuput

        private static void ObserveScenarioOuput(IObservable<int> count)
        {
            count
                .Sum()
                .Subscribe(total => ScenarioSimulatorEventSource.Log.FinalEventCountForAllDevices(total));

            count
                .Buffer(TimeSpan.FromMinutes(5))
                .Scan(0, (total, next) => total + next.Sum())
                .Subscribe(total => ScenarioSimulatorEventSource.Log.CurrentEventCountForAllDevices(total));

            count
                .Buffer(TimeSpan.FromMinutes(0.1))
                .TimeInterval()
                .Select(x => x.Value.Sum() / x.Interval.TotalSeconds)
                .Subscribe(rate => ScenarioSimulatorEventSource.Log.CurrentEventsPerSecond(rate));
        }
开发者ID:carloserodriguez2000,项目名称:iot-journey,代码行数:17,代码来源:SimulationProfile.cs

示例4: DetectCorrectKeypass

 public IObservable<bool> DetectCorrectKeypass(IObservable<string> keypresses, string password, TimeSpan delay, IScheduler scheduler)
 {
     return keypresses
         .Buffer(delay, password.Length, scheduler)
         .Select(listStr => string.Join(string.Empty, listStr.ToArray()))
         .Do(guess => EnteredPassKey = guess)
         .Where(guess => guess != string.Empty)
         .Select(guess => guess == password)
         .DistinctUntilChanged();
 }
开发者ID:holdensmagicalunicorn,项目名称:Rx-Demo,代码行数:10,代码来源:MainWindow.xaml.cs

示例5: Apply

 public IObservable<IEnumerable<DataPoint>> Apply(IObservable<DataPoint> dataPoints)
 {
     return dataPoints.Buffer(BufferSize);
 }
开发者ID:jonnii,项目名称:statr,代码行数:4,代码来源:BufferedStrategy.cs

示例6: Filter

 public static IObservable<float> Filter(IObservable<float> src, int bufferSize, int dropSize, int takeSize)
 {
     return src.Buffer(bufferSize).Select((buffered, index) => ApplyFilter(buffered, index, dropSize, takeSize));
 }
开发者ID:Shinbuev,项目名称:Orthopedy,代码行数:4,代码来源:SortSkipTakeAvgFilter.cs


注:本文中的IObservable.Buffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。