private async void LvwItems_ItemSelected(object sender, SelectedItemChangedEventArgs e) { try { if (lvwItems.SelectedItem != null) { device = lvwItems.SelectedItem as IDevice; connected2Device = await btManager.Connect(device, adapter); if (connected2Device) { CacheProvidor.Set <IDevice>("device", device, DateTime.Now.AddDays(1)); characteristic = await btManager.GetCharasteric(device); CacheProvidor.Set <ICharacteristic>("characteristic", characteristic, DateTime.Now.AddDays(1)); await Navigation.PushModalAsync(new NavigationPage(new MasterPage())); } else { await DisplayAlert("Foutmelding", "Verbinding maken is mislukt. We scannen opnieuw voor u.", "Ok"); StartUp(); } } lvwItems.SelectedItem = null; } catch (Exception ex) { await StepOutManager.Writelog(ex); await DisplayAlert("Fout", "Er is iets misgelopen bij het connecteren met een bluetooth device, als dit blijft voorkomen gelieve contact op te nemen met de suport.", "Ok"); } }
private async void StartUp() { try { imgEx.Source = Variatie.Foto[0]; Title = "Set " + Sets.ToString() + "/3"; lblOef.Text = Variatie.Naam; lblRepetities.Text = Fiche.Score.Excellent.ToString(); imgHeart.Source = "heart.png"; imgHeart2.Source = "heart.png"; reading = true; if (Variatie.Naam != "") { lblOef.Text = Variatie.Naam; } else { lblOef.Text = Fiche.WorkoutName; } var characteristic = CacheProvidor.Get <ICharacteristic>("characteristic"); if (characteristic != null) { await getHeartRate(characteristic); } } catch (Exception ex) { await StepOutManager.Writelog(ex); await DisplayAlert("Fout", "Fout bij het laden van de pagina", "Ok"); } }
public async void OnSignOutTapped(object sender, EventArgs e) { try { this.IsPresented = false; if (Application.Current.Properties.ContainsKey("Current_User")) { Application.Current.Properties.Remove("Current_User"); } await Navigation.PushModalAsync(new NavigationPage(new MainPage())); CacheManager.RemoveAllSyncEvaluations(); if (CrossConnectivity.Current.IsConnected) { await StepOutManager.SyncAllFichesBO(); } await Application.Current.SavePropertiesAsync(); StepOutManager.CurrentUser = ""; BluetoothManager bluetoothManager = new BluetoothManager(); IDevice device = CacheProvidor.Get <IDevice>("device"); if (device != null) { await bluetoothManager.Disconnect(device, CrossBluetoothLE.Current.Adapter); } //await Navigation.PushModalAsync(new NavigationPage(new MainPage())); //detailPage.Title = "Profile"; //detailPage.Content = new ProfileView(); } catch (Exception ex) { await StepOutManager.Writelog(ex); await DisplayAlert("Fout", "Er is iets misgelopen bij het uitloggen, als deze fout zich blijft voordoen neemt men best contact op met de support.", "OK"); } }