async private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { mealaroniApi = (apiMealaroni)e.NavigationParameter; BizName.Text = mealaroniApi.selectedBiz.name; await mealaroniApi.getMenu(mealaroniApi.selectedBiz.city, mealaroniApi.selectedBiz.state, mealaroniApi.selectedBiz.country, mealaroniApi.selectedBiz.phone); mealaroniApi.selectedBiz.storehours = mealaroniApi.menus[0].storehours; foreach(apiMealaroni.Menu menu in mealaroniApi.menus) { string menuName = menu.menu; HubSection menusection = new HubSection(); menusection.Header = menuName; menusection.Margin = MenuItemListView.Margin; menusection.ContentTemplate = (DataTemplate)this.Resources["MenuTemplate"]; menusection.HeaderTemplate = (DataTemplate)this.Resources["HubSectionHeaderTemplate"]; MenuHub.Sections.Add(menusection); menusection.DataContext = mealaroniApi.menuItems.Where(fd => fd.menu == menuName).ToList(); } MenuItemListView.Header = "Full Menu"; MenuItemListView.DataContext = mealaroniApi.menuItems; }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { mealaroniApi = (apiMealaroni)e.NavigationParameter; }
/// <summary> /// The methods provided in this section are simply used to allow /// NavigationHelper to respond to the page's navigation methods. /// <para> /// Page specific logic should be placed in event handlers for the /// <see cref="NavigationHelper.LoadState"/> /// and <see cref="NavigationHelper.SaveState"/>. /// The navigation parameter is available in the LoadState method /// in addition to page state preserved during an earlier session. /// </para> /// </summary> /// <param name="e">Provides data for navigation methods and event /// handlers that cannot cancel the navigation request.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { hours.Children.Clear(); hoursVal.Children.Clear(); mealaroniApi = (apiMealaroni)e.Parameter; this.navigationHelper.OnNavigatedTo(e); bizname.Text = mealaroniApi.selectedBiz.name; bizaddr.Text = mealaroniApi.selectedBiz.address; bizphone.Text = mealaroniApi.selectedBiz.phone; if (mealaroniApi.menus[0].storehours!=null) { foreach(IXmlNode nd in mealaroniApi.menus[0].storehours.ChildNodes ) { TextBlock day = new TextBlock{ Text = string.Format("{0}",nd.NodeName), Margin = new Thickness(0,8,0,0) }; TextBlock time = new TextBlock{ Text = string.Format("{0}",nd.Attributes.GetNamedItem("hours").NodeValue), Margin = new Thickness(0, 8, 0, 0) }; day.FontSize = time.FontSize = 20; hours.Children.Add(day); hoursVal.Children.Add(time); } } }
private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { if (App.Context.mealaroniAppApi != null) { string searchKey = App.Context.searchTerm; bizList.DataContext = null; //bizlisting.Clear(); mealaroniApi = App.Context.mealaroniAppApi; bizList.Header = mealaroniApi.locationPicker.city.ToUpper() + "," + mealaroniApi.locationPicker.state.ToUpper(); bizlisting = mealaroniApi.bizItems.Where(fd => fd.name.ToLower().Contains(searchKey) || searchKey=="all" ).ToList(); bizList.DataContext = bizlisting; App.Context.mealaroniAppApi = null; return; } await loadBizList(); }
private void GroupSection_ItemClick(apiMealaroni.BizItem e) { var country = e.country; var state = e.state; var city = e.city; var namekey = e.namekey; var phone = e.phone; mealaroniApi.selectedBiz = e; if (!Frame.Navigate(typeof(SectionPage), mealaroniApi)) { throw new Exception(this.resourceLoader.GetString("NavigationFailedExceptionMessage")); } }