Example #1
0
        public static async Task WaitForCompletion(ExpensiveComputation comp)
        {
            Console.WriteLine($"WaitForCompletion started on thread {Thread.CurrentThread.ManagedThreadId}");
            await comp.Completion;

            Console.WriteLine($"WaitForCompletion completed on thread {Thread.CurrentThread.ManagedThreadId}");
            UpdateProgress("✌︎");
        }
Example #2
0
        public static void Start(int n)
        {
            var comp = new ExpensiveComputation(n);

            comp.Start();
            #pragma warning disable CS4014
            WaitForCompletion(comp);
            _demo = new Demo(UpdateProgress, comp);
        }
Example #3
0
 public Demo(Action <string> updateProgress, ExpensiveComputation comp)
 {
     _updateProgress       = updateProgress;
     _animation            = new Animation(updateProgress);
     _expensiveComputation = comp;
 }