I have a list view that is populated with the location of some html files on the local disk. When an the list is double clicked it takes the first selected item and loads that file location to the web browser control. I have fiddled around with async/await to try and get the UI free while the file loads to the web browser but it still hangs the UI.
private async void ListView1_DoubleClick(object sender, EventArgs e)
{
await LoadPage(listView1.SelectedItems[0].Text);
}
private async Task LoadPage(string uri)
{
Uri myURI = new Uri(uri);
await Task.Factory.StartNew(()=>webBrowser1.Navigate(myURI),CancellationToken.None,TaskCreationOptions.LongRunning,TaskScheduler.Default);
}
Code works, the UI is still hanging though.