// ------------------ 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"); }
private static async void EntryPoint(Coordinator coordinator) { RegisterForFirstLabel(coordinator); RegisterForFirstLabelAgain(coordinator); RegisterForSecondLabel(coordinator); Console.WriteLine("Hitting first label..."); await coordinator.Label("FirstLabel"); Console.WriteLine("Hitting second label..."); await coordinator.Label("SecondLabel"); }
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"); }
// ------------------ 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"); }