Esempio n. 1
0
        // ------------------ COMPLEX EXAMPLE ------------------
        private static async void ComplexEntryPoint(Coordinator coordinator)
        {
            await coordinator.Execute(SetUpLogComeFrom);

            int count = 0;
            await coordinator.ComeFrom("End");

            Console.WriteLine("Just after ComeFrom(End). count={0}", count);
            if (count == 5)
            {
                Console.WriteLine("Okay, we're done now");
                return;
            }
            count++;

            await coordinator.Label("Log");

            await coordinator.ComeFrom("Middle");

            Console.WriteLine("Just after ComeFrom(Middle). count={0}", count);

            if (count < 3)
            {
                await coordinator.Label("TimestampedLog");

                count++;
                await coordinator.Label("Middle");
            }
            await coordinator.Label("End");
        }
Esempio n. 2
0
        // ------------------ COMPLEX EXAMPLE ------------------
        private static async void ComplexEntryPoint(Coordinator coordinator)
        {
            await coordinator.Execute(SetUpLogComeFrom);
            int count = 0;
            await coordinator.ComeFrom("End");

            Console.WriteLine("Just after ComeFrom(End). count={0}", count);
            if (count == 5)
            {
                Console.WriteLine("Okay, we're done now");
                return;
            }
            count++;

            await coordinator.Label("Log");

            await coordinator.ComeFrom("Middle");
            Console.WriteLine("Just after ComeFrom(Middle). count={0}", count);

            if (count < 3)
            {
                await coordinator.Label("TimestampedLog");
                count++;
                await coordinator.Label("Middle");
            }
            await coordinator.Label("End");
        }
Esempio n. 3
0
        private static async void SetUpLogComeFrom(Coordinator coordinator)
        {
            await coordinator.ComeFrom("TimestampedLog");

            Console.WriteLine("Message at {0}", DateTime.Now);

            // It would be nice to be able to pass a value, but that's tricky
            // for various reasons.
            await coordinator.ComeFrom("Log");

            Console.WriteLine("We logged something.");
        }
Esempio n. 4
0
        private static async void RegisterForFirstLabel(Coordinator coordinator)
        {
            Console.WriteLine("Registering interest");
            await coordinator.ComeFrom("FirstLabel");

            Console.WriteLine("Looks like the first label was hit! (Let's hit it again.)");
            await coordinator.Label("FirstLabel");

            Console.WriteLine("Done with the first label now");
        }
Esempio n. 5
0
        private static async void RegisterForFirstLabel(Coordinator coordinator)
        {
            Console.WriteLine("Registering interest");
            await coordinator.ComeFrom("FirstLabel");

            Console.WriteLine("Looks like the first label was hit! (Let's hit it again.)");
            await coordinator.Label("FirstLabel");

            Console.WriteLine("Done with the first label now");
        }
Esempio n. 6
0
        private static async void SimpleOtherMethod(Coordinator coordinator)
        {
            Console.WriteLine("Start of SimpleOtherMethod");

            int count = 0;
            await coordinator.ComeFrom("x");

            Console.WriteLine("After ComeFrom x in SimpleOtherMethod. count={0}. Returning.",
                              count);
            count++;
        }
Esempio n. 7
0
        private static async void SimpleOtherMethod(Coordinator coordinator)
        {
            Console.WriteLine("Start of SimpleOtherMethod");

            int count = 0;
            await coordinator.ComeFrom("x");

            Console.WriteLine("After ComeFrom x in SimpleOtherMethod. count={0}. Returning.",
                              count);
            count++;
        }
Esempio n. 8
0
        // ------------------ SIMPLE EXAMPLE ------------------
        private static async void SimpleEntryPoint(Coordinator coordinator)
        {
            await coordinator.Execute(SimpleOtherMethod);

            Console.WriteLine("First call to Label(x)");
            await coordinator.Label("x");

            Console.WriteLine("Second call to Label(x)");
            await coordinator.Label("x");

            Console.WriteLine("Registering interesting in y");
            bool firstTime = true;
            await coordinator.ComeFrom("y");

            Console.WriteLine("After ComeFrom(y). FirstTime={0}", firstTime);

            if (firstTime)
            {
                firstTime = false;
                await coordinator.Label("y");
            }
            Console.WriteLine("Finished");
        }
Esempio n. 9
0
        // ------------------ SIMPLE EXAMPLE ------------------
        private static async void SimpleEntryPoint(Coordinator coordinator)
        {
            await coordinator.Execute(SimpleOtherMethod);

            Console.WriteLine("First call to Label(x)");
            await coordinator.Label("x");

            Console.WriteLine("Second call to Label(x)");
            await coordinator.Label("x");

            Console.WriteLine("Registering interesting in y");
            bool firstTime = true;
            await coordinator.ComeFrom("y");

            Console.WriteLine("After ComeFrom(y). FirstTime={0}", firstTime);

            if (firstTime)
            {
                firstTime = false;
                await coordinator.Label("y");
            }
            Console.WriteLine("Finished");
        }
Esempio n. 10
0
        private static async void SetUpLogComeFrom(Coordinator coordinator)
        {
            await coordinator.ComeFrom("TimestampedLog");
            Console.WriteLine("Message at {0}", DateTime.Now);

            // It would be nice to be able to pass a value, but that's tricky
            // for various reasons.
            await coordinator.ComeFrom("Log");
            Console.WriteLine("We logged something.");
        }
Esempio n. 11
0
        private static async void RegisterForSecondLabel(Coordinator coordinator)
        {
            await coordinator.ComeFrom("SecondLabel");

            Console.WriteLine("Second label hit too");
        }
Esempio n. 12
0
        private static async void RegisterForFirstLabelAgain(Coordinator coordinator)
        {
            await coordinator.ComeFrom("FirstLabel");

            Console.WriteLine("Looks like the first label was hit a second time!");
        }
Esempio n. 13
0
        private static async void RegisterForSecondLabel(Coordinator coordinator)
        {
            await coordinator.ComeFrom("SecondLabel");

            Console.WriteLine("Second label hit too");
        }
Esempio n. 14
0
        private static async void RegisterForFirstLabelAgain(Coordinator coordinator)
        {
            await coordinator.ComeFrom("FirstLabel");

            Console.WriteLine("Looks like the first label was hit a second time!");
        }