Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Form1()
- {
- InitializeComponent();
- CheckForIllegalCrossThreadCalls = true;
- }
- async Task DelayAsync()
- {
- // GUI context is captured here (right before the following await)
- await Task.Delay(3000);//.ConfigureAwait(false);
- // As no code follows the preceding await, there is no continuation that uses the captured GUI context.
- }
- private async void Button1_Click(object sender, EventArgs e)
- {
- Task t = DelayAsync();
- t.Wait();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement