Implementing Cancellation
Let’s look at the WPF sample application created in the section “Getting Started with Async
/Await
.” Imagine you want to give users the ability of cancelling the download of the RSS feed from the Microsoft Channel9 website. First, make a slight modification to the user interface so that the main Grid
is divided into two rows, and in the first row add a Button
like this:
<Grid.RowDefinitions> <RowDefinition Height="40"/> <RowDefinition/></Grid.RowDefinitions><Button Width="120" Height="30" Name="CancelButton" Content="Cancel"/>
Do not forget to add the Grid.Row="1"
property assignment for the ListBox
control. Double-click the new button so that you can quickly access the code ...
Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.