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

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

            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());
                b.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                a.OnCompleted2();
                b.OnNext2(gen.Next());
                b.OnCompleted2();

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

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

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

                a.OnNext2("a");
                a.OnNext2("a");
                a.OnNext2("aa");
                a.OnNext2("aaa");
                a.OnNext2("aaa");
                a.OnNext2("aa");
                a.OnNext2("a");
                a.OnNext2("a");
                a.OnNext2("a");
                a.OnCompleted2();

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

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

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

                a.OnNext2("2");
                a.OnCompleted2();

                Thread.Sleep(3000);

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

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

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

                a.OnNext2("a");
                a.OnNext2("aa");
                a.OnNext2("aaa");
                a.OnNext2("aaaa");
                a.OnCompleted2();

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

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

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

                a.OnNext2(DateTime.Now.ToString("F"));
                a.OnNext2(DateTime.Now.ToString("F"));
                Thread.Sleep(3000);
                a.OnNext2(DateTime.Now.ToString("F"));
                a.OnNext2(DateTime.Now.ToString("F"));
                a.OnCompleted2();

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

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

            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());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnCompleted2();

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

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

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

                a.OnNext2(DateTime.Now.ToString("F"));
                a.OnNext2(DateTime.Now.ToString("F"));
                Thread.Sleep(3000);
                a.OnNext2(DateTime.Now.ToString("F"));
                a.OnNext2(DateTime.Now.ToString("F"));
                a.OnCompleted2();

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

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

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

                a.OnNext2("2");
                a.OnCompleted2();

                Thread.Sleep(3000);

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

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

            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());
                a.OnCompleted2();
                b.OnNext2(gen.Next());
                b.OnNext2(gen.Next());

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

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

            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());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnCompleted2();

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