async void LvWebsites_ItemSelected(object sender, SelectedItemChangedEventArgs e) { if (e.SelectedItem == null) { return; } NightScout nsItem = (NightScout)e.SelectedItem; MessagingCenter.Send <MasterPage, NightScout>(this, "NightScout", nsItem); await Navigation.PushAsync(new DetailPage()); ((ListView)sender).SelectedItem = null; }
List <NightScout> nsList; // = new List<NightScout>(); public MasterPage() { InitializeComponent(); nsWebsite = new NightScout(); BindingContext = nsWebsite; NightScout n = new NightScout(); n.T1DName = "Lydia"; n.NSURL = "evaroo.azurewebsites.net"; nsList = new List <NightScout>(); nsList.Add(n); lvWebsites.ItemsSource = nsList; lvWebsites.ItemSelected += LvWebsites_ItemSelected; //MessagingCenter.Subscribe<MasterPage>(this,"Add", (obj) => lvWebsites.ItemsSource = nsList); btnAdd.Clicked += BtnAdd_Clicked; }
public DetailPage() { InitializeComponent(); if (nsWeb == null) { nsWeb = new NightScout(); nsWeb.NSURL = "evaroo.azurewebsites.net"; } MessagingCenter.Subscribe <MasterPage, NightScout>(this, "NightScout", (page, nsItem) => { nsWeb = nsItem; }); this.BindingContext = _viewModel = new EventsViewModel(); BackgroundColor = Xamarin.Forms.Device.OnPlatform(Xamarin.Forms.Color.White, Xamarin.Forms.Color.White, Xamarin.Forms.Color.Transparent); //nsWeb = nsWebsite; }