void DoDisconnect() { try { IsBusy = true; var t = Task.Run(async() => { await mgr.DisConnectAsync(); }); t.Wait(); } finally { IsBusy = false; } }
async void Disconn_Clicked(object sender, EventArgs e) { var mpv = this.BindingContext as MainPageVM; try { mpv.IsBusy = true; mpv.IsConnected = false; await mgr.DisConnectAsync(); } catch (Exception ex) { // Device.BeginInvokeOnMainThread(() => { await DisplayAlert("Error", ex.Message, "OK"); // }); } finally { mpv.IsBusy = false; } }