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


C# IObservable.Where方法代码示例

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


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

示例1: Execute

        public IObservable<object> Execute(IObservable<Tuple<string, string>> stream)
        {
            var faces = stream.Where(t => t.Item1 == "faces").Select(t => t.Item2);
               var height = stream.Where(t => t.Item1 == "height").Select(t => double.Parse(t.Item2));

               return faces.CombineLatest(height, (f, h) => h > 2.0).Select(b => b.ToString());
        }
开发者ID:JamesTryand,项目名称:Metarx,代码行数:7,代码来源:drone.cs

示例2: Execute

        public IObservable<object> Execute(IObservable<Tuple<string, string>> stream)
        {
            var first = stream.Where(t => t.Item1 == "firstname").Select(t => t.Item2);
            var last = stream.Where(t => t.Item1 == "lastname").Select(t => t.Item2);

            var zipped = first.Zip(last, (f, b) => f + " " + b);
            return zipped;
        }
开发者ID:JamesTryand,项目名称:Metarx,代码行数:8,代码来源:SampleProgram.cs

示例3: Execute

        public IObservable<object> Execute(IObservable<Tuple<string, string>> stream)
        {
            var foo = stream.Where(t => t.Item1 == "foo").Select(t => t.Item2);
               var bar = stream.Where(t => t.Item1 == "bar").Select(t => t.Item2);

               return foo.Zip(bar, (f, b) => f + ":" + b)
              .Select(v => v + " is " + v.Length + " chars long.");
        }
开发者ID:JamesTryand,项目名称:Metarx,代码行数:8,代码来源:zip.cs

示例4: ActivityViewModel

 public ActivityViewModel(IObservable<ApplicationActivityMessage> activityMessages)
 {
     var busyStream1 = activityMessages
         .Where(msg => msg.GettingBusy)
         .ObserveOnDispatcher().Subscribe(onGettingBusy);
     var busyStream2 = activityMessages
         .Where(msg => msg.GettingCalm)
         .ObserveOnDispatcher().Subscribe(onGettingCalm);
     disposer.Add(busyStream1, busyStream2);
 }
开发者ID:flq,项目名称:TheDailyTweeter,代码行数:10,代码来源:ActivityViewModel.cs

示例5: ActivityContainer

 public ActivityContainer(IObservable<ActivityMsg> activityMessages)
 {
     var busyStream1 = activityMessages
        .Where(msg => msg.GettingBusy)
        .ObserveOnDispatcher().Subscribe(OnGettingBusy);
     var busyStream2 = activityMessages
         .Where(msg => msg.GettingCalm)
         .ObserveOnDispatcher().Subscribe(OnGettingCalm);
     disposer.Add(busyStream1, busyStream2);
 }
开发者ID:flq,项目名称:SoftLattice,代码行数:10,代码来源:ActivityContainer.cs

示例6: Execute

        public IObservable<object> Execute(IObservable<Tuple<string, string>> stream)
        {
            var faces = stream
              .Where(t => t.Item1 == "faces")
              .Select(t => t.Item2)
              .Where(s => s.Length > 2);

               var height = stream.Where(t => t.Item1 == "height").Select(t => double.Parse(t.Item2));

               return faces.Zip(height, (f, h) => f + "..." + h);
        }
开发者ID:JamesTryand,项目名称:Metarx,代码行数:11,代码来源:fh.cs

示例7: Execute

        public IObservable<object> Execute(IObservable<Tuple<string, string>> stream)
        {
            var faces = stream
                .Where(t => t.Item1 == "faces")
                .Select(t => t.Item2)
                .Where(s => !s.Equals("[]"));

            var navdata = stream
                .Where(t => t.Item1 == "navdata")
                .Select(t => t.Item2);

            return faces.CombineLatest(navdata, (f, n) => "Use " + f + " with " + n);
        }
开发者ID:JamesTryand,项目名称:Metarx,代码行数:13,代码来源:combinelatest.cs

示例8: Execute

 public IObservable<object> Execute(IObservable<Tuple<string, string>> stream)
 {
     return stream
       .Where(t => t.Item1 == "<default>")
       .Select(t => t.Item2)
       .Select(v => v + " is " + v.Length + " chars long.");
 }
开发者ID:JamesTryand,项目名称:Metarx,代码行数:7,代码来源:streamprogram.cs

示例9: FilterFileSystemEntities

 public override IObservable<FileSystemEntity> FilterFileSystemEntities(IObservable<FileSystemEntity> source)
 {
     return source.Where(x =>
                             {
                                 return x.CreationTime < _dateTime;
                             });
 }
开发者ID:cburgdorf,项目名称:Blockbuster,代码行数:7,代码来源:IsOlder.cs

示例10: computePlayerData

 public static IEnumerable<IObservable<PlayerData>> computePlayerData(IObservable<SensorData> src)
 {
     var scheduler = new EventLoopScheduler();
     return
       MetaData
       .PLAYER_MAP
       .Select((KeyValuePair<string, List<int>> keyValue, int index) =>
       {
     var pt = PerformanceTest.ptArray[index];
     var sensorList = keyValue.Value; //The list of sensors attached to this player
     var sensorStreamList =
           sensorList.Select((int sensor_id) =>
                                {
                                  return src//.ObserveOn(scheduler)
                                            .Where(ss => ss.sensor_id == sensor_id)
                                            .Once(MetaData.getDefaultSensorDataWithSensorID(sensor_id));
                                });
     return
       Observable
         .Zip(sensorStreamList)
         //If AvgProcessorStatus==true, then compute performance metrics for AverageProcessor.
         .DoIf(() => PerformanceTest.AvgProcessorStatus, d => pt.recordTime())
         .Select(returnPlayerData)
         .Where(data => !String.IsNullOrEmpty(data.player_name))
         //compute time taken to produce a PlayerData sample from list of updated sensor values.
         .DoIf(() => PerformanceTest.AvgProcessorStatus, d => pt.computeMetrics());
       });
 }
开发者ID:mindis,项目名称:rticonnextdds-reactive,代码行数:28,代码来源:AverageProcessor.cs

示例11: Main

        static void Main(string[] args)
        {
            _listener.Prefixes.Add("http://" + Environment.MachineName + ":9000/");
            _listener.Start();
            Console.WriteLine("Listening ...");

            while (true)
            {
                HttpListenerContext context = _listener.GetContext();
                _request = context.Request;

                HttpListenerResponse response = context.Response;

                _sb = new StringBuilder("<HTML>\n<HEAD>\n<TITLE>");
                _sb.Append("Trace 2 Html");
                _sb.Append("</TITLE>\n</HEAD>\n<BODY>\n");
                _sb.Append("<pre style=\"font-family:Consolas; font-size: 10pt; width: 5000px;\">");

                _playback = new Playback();
                _playback.AddEtlFiles(LocalTrace);
                _all = _playback.GetObservable<TracedEvent>();

                if (_request.QueryString["process"] != null)
                {
                    _processFilter = _request.QueryString["process"];
                    _all = _all.Where(e => e.Message.StartsWith(_processFilter));
                }
                else
                {
                    _processFilter = null;
                }

                if (_request.QueryString["after"] != null)
                {
                    var after = int.Parse(_request.QueryString.Get("after"));
                    AllHistory(after);
                }
                else if (_request.QueryString["afterReceive"] != null)
                {
                    string messageId = _request.QueryString.Get("afterReceive");
                    AfterReceive(messageId);
                }
                else if (_request.QueryString["beforeSend"] != null)
                {
                    string messageId = _request.QueryString.Get("beforeSend");
                    BeforeSend(messageId);
                }
                else
                {
                    AllHistory(0);
                }
                _sb.Append("</BODY></HTML>");
                byte[] buffer = Encoding.UTF8.GetBytes(_sb.ToString());
                response.ContentLength64 = buffer.Length;
                response.OutputStream.Write(buffer, 0, buffer.Length);
                response.OutputStream.Close();
                _playback.Dispose();
            }
        }
开发者ID:modulexcite,项目名称:Tx,代码行数:59,代码来源:Program.cs

示例12: PreviewViewModel

 public PreviewViewModel(IObservable<NewHtmlMsg> newHtmlMessages, IDispatchServices svc, IPublisher publisher)
 {
     _publisher = publisher;
     newHtmlMessages
         .Where(msg => _browserCompletedLoad)
         .ObserveOn(svc)
         .Subscribe(NextHtml);
 }
开发者ID:flq,项目名称:Thawmadoce,代码行数:8,代码来源:PreviewViewModel.cs

示例13: ViewController

 public ViewController(IObservable<IGameEvent> events)
 {
     events.Where(e => e is Tick || e is PositionChanged).ObserveOnDispatcher().Subscribe(e => UpdatePositions());
     events.OfType<SurfaceAdded>().ObserveOnDispatcher().Subscribe(OnSurfaceAdded);
     events.OfType<GameObjectAdded>().ObserveOnDispatcher().Subscribe(OnGameObjectAdded);
     Views = new ObservableCollection<UserControl>();
     _viewModels = new List<ViewModelBase>();
 }
开发者ID:rho24,项目名称:Golf,代码行数:8,代码来源:ViewController.cs

示例14: LongPressAsObservable

 private static IObservable<KeyAndState> LongPressAsObservable(IObservable<KeyAndState> press, IObservable<KeyAndState> release, TimeSpan delay, IScheduler scheduler)
 {
     return press.SelectMany(
         pressed =>
         Observable
             .Return(pressed)
             .Delay(delay, scheduler)
             .TakeUntil(release.Where(released => pressed.Key == released.Key)));
 }
开发者ID:HaKDMoDz,项目名称:shooter,代码行数:9,代码来源:ReactiveKeyboardExtensions.cs

示例15: SetUp

 public IDisposable SetUp(IObservable<string> source)
 {
     return source
     .Where(Matches)
     .DelayBetweenValues(TimeSpan.FromSeconds(5),
                     TaskPoolScheduler.Default,
                     () => RxMessageBrokerMinimod.Default.Send(new Log("You pressed the 'Delete current file' key in quick succession. " +
                                                                       "This key press will be ignored.")))
     .Subscribe(x => Handle());
 }
开发者ID:agross,项目名称:mpc-deleter,代码行数:10,代码来源:DeleteCurrentFileKey.cs


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