/// <summary> /// Navigate to Adult Dosage calculator /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void Button_Clicked(object sender, EventArgs e) { var drug = (PrimaryDrug)DrugDetails.BindingContext; Task <List <AdultDosage> > task = App.LocalDatabase.GetAdultDosages(drug); var drugCount = task.Result.Count(); if (drugCount == 1) { AdultDosage dosage = task.Result.FirstOrDefault(); var page = new DrugCalculator(dosage); page.Title = "Adult Dosage"; if (drug != null) { // DrugCalculatorViewModel.Shared = new DrugCalculatorViewModel(drug); // page.BindingContext = drug; } await Navigation.PushAsync(page); } else { var page = new DrugSubCategoryPage(task.Result); page.BindingContext = task.Result; await Navigation.PushAsync(page); } }
async void Handle_ItemTapped(object sender, ItemTappedEventArgs e) { if (e.Item == null) { return; } AdultDosage dosage = e.Item as AdultDosage; var page = new DrugCalculator(dosage); page.Title = "Adult Dosage"; await Navigation.PushAsync(page); //Deselect Item ((ListView)sender).SelectedItem = null; }