// ------------------ 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"); }
// ------------------ 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"); }
// ------------------ 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"); }
// ------------------ 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"); }