Exemplo n.º 1
0
        private async void Bttn3_Click(object sender, RoutedEventArgs e)
        {
            var cancelSource = new CancellationTokenSource(TimeSpan.FromSeconds(1));

            cancelSource.Token.ThrowIfCancellationRequested();
            Task t = DemonstrationMethods.WrapSynchronousInAsynchronousMethod(cancelSource.Token);

            StatusBlock.Text = "Finished - Synchronous on separate thread";
        }
Exemplo n.º 2
0
 private async void Bttn6_Click(object sender, RoutedEventArgs e)
 {
     DemonstrationMethods.SynchronousTemporaryContextRemovalMethod();
     StatusBlock.Text = "Finished - Synchronous using safe getter";
 }
Exemplo n.º 3
0
 private async void Bttn5_Click(object sender, RoutedEventArgs e)
 {
     DemonstrationMethods.SynchronousUsingStephenClearyMethod();
     StatusBlock.Text = "Finished - Synchronous using Stephen Cleary method";
 }
Exemplo n.º 4
0
 private async void Bttn4_Click(object sender, RoutedEventArgs e)
 {
     DemonstrationMethods.SynchronousWithNoCapturedContinuationMethod();
     StatusBlock.Text = "Finished - Synchronous without captured context";
 }
Exemplo n.º 5
0
        private async void Bttn2_Click(object sender, RoutedEventArgs e)
        {
            await DemonstrationMethods.AsyncAllTheWayDownMethod();

            StatusBlock.Text = "Finished - Asynchronous";
        }
Exemplo n.º 6
0
 private async void Bttn1_Click(object sender, RoutedEventArgs e)
 {
     DemonstrationMethods.FullySynchronousMethod();
     StatusBlock.Text = "Finished - Synchronous - DEADLOCK!";
 }