private async Task AutoCompleteRent() { AutoCompleteModel model = null; Task.Factory.StartNew( // tasks allow you to use the lambda syntax to pass wor () => { //model = WebService.GetAutoCompleteLocation(txtAddressRent.Text); }).ContinueWith(async t => { if (model != null) { Device.BeginInvokeOnMainThread(async() => { }); } }, TaskScheduler.FromCurrentSynchronizationContext() ); }
private async Task AutoComplete() { string[] _autocompleteArray = null; AutoCompleteModel model = null; Task.Factory.StartNew( // tasks allow you to use the lambda syntax to pass wor () => { model = WebService.GetAutoCompleteLocation(lblAddress_sell.Text); }).ContinueWith(async t => { if (model != null) { lstViewSell.IsVisible = true; lstViewSell.ItemsSource = model.predictions; Device.BeginInvokeOnMainThread(async() => { }); } }, TaskScheduler.FromCurrentSynchronizationContext() ); }