Exemplo n.º 1
0
        static async void SaveResumeDemo(Executioner executioner)
        {
            if (File.Exists("state.dat"))
            {
                await executioner.CreateAwaitable(machine => machine.LoadFrom("state.dat"));

                Console.WriteLine("We'll never get here");
            }
            Console.WriteLine("Looks like this is the first time through");
            string startTime = DateTime.Now.ToString();

            for (int i = 0; i < 10; i++)
            {
                await executioner.CreateAwaitable(machine => machine.SaveTo("state.dat"));

                Console.WriteLine("Started at: {0}", startTime);
                Console.WriteLine("i = {0}. Continue? ", i);
                string text = Console.ReadLine();
                if (text == "n")
                {
                    return;
                }
            }
            Console.WriteLine("Completed!");
            File.Delete("state.dat");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var executioner = new Executioner(SaveResumeDemo);

            executioner.Start();
        }