コード例 #1
0
ファイル: SampleDiagrams.cs プロジェクト: zwq00000/RxSandbox
        public void Concat()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

            var gen        = new InputGenerator();
            var definition = StandardOperators.Concat();

            using (var instance = ExpressionInstance.Create(definition))
            {
                var a = instance.GetInput("a");
                var b = instance.GetInput("b");

                b.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                a.OnCompleted2();
                b.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                b.OnCompleted2();

                AddDiagram("Concat", instance.Diagram);
            }
        }
コード例 #2
0
ファイル: SampleDiagrams.cs プロジェクト: zwq00000/RxSandbox
        public void BufferWithTime()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

            var gen        = new InputGenerator();
            var definition = StandardOperators.BufferWithTime();

            using (var instance = ExpressionInstance.Create(definition))
            {
                var a = instance.GetInput("a");

                Thread.Sleep(100);
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                Thread.Sleep(3000);
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnCompleted2();

                AddDiagram("BufferWithTime", instance.Diagram);
            }
        }
コード例 #3
0
        public void Amb()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

            var gen = new InputGenerator();
            var definition = StandardOperators.Amb();

            using (var instance = ExpressionInstance.Create(definition))
            {
                var a = instance.GetInput("a");
                var b = instance.GetInput("b");

                a.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                b.OnCompleted2();
                a.OnCompleted2();

                AddDiagram("Amb", instance.Diagram);
            }
        }
コード例 #4
0
        public void BufferWithTime()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

            var gen = new InputGenerator();
            var definition = StandardOperators.BufferWithTime();

            using (var instance = ExpressionInstance.Create(definition))
            {
                var a = instance.GetInput("a");

                Thread.Sleep(100);
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                Thread.Sleep(3000);
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnCompleted2();

                AddDiagram("BufferWithTime", instance.Diagram);
            }
        }