/// <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>
        async private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            try
            {
                Windows.Storage.StorageFile file = null;
                Windows.Storage.StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
                file = await local.GetFileAsync("profile.xml");

                Stream fStream = await file.OpenStreamForReadAsync();
                StreamReader sr = new StreamReader(fStream);
                string result2 = sr.ReadToEnd();
                sr.Dispose();
                fStream.Dispose();
                XmlDocument profile = new XmlDocument();
                profile.LoadXml(result2);
                input_email.Text = profile.DocumentElement.SelectSingleNode("email").InnerText;
                input_username.Text = profile.DocumentElement.SelectSingleNode("username").InnerText;
                input_phone.Text = profile.DocumentElement.SelectSingleNode("phone").InnerText;


            }
            catch
            {
              
            }

        }
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            apiMealaroni menuItem = (apiMealaroni)e.NavigationParameter;
            BizName.Text = menuItem.selectedBiz.name+": "+menuItem.selectedItem.menu;
            HubSection overview = new HubSection();
            overview.ContentTemplate = (DataTemplate)this.Resources["ItemTemplate"];
            overview.Header = menuItem.selectedItem.name;
            overview.HeaderTemplate = (DataTemplate)this.Resources["HubSectionHeaderTemplate"];
            itemHub.Sections.Add(overview);
            overview.DataContext = menuItem.selectedItem;
            if (menuItem.selectedItem.options != null)
            {
                foreach (IXmlNode option in menuItem.selectedItem.options.ChildNodes)
                {
                    HubSection optionHub = new HubSection();
                    optionHub.HeaderTemplate = (DataTemplate)this.Resources["HubSectionHeaderTemplate"];
                    optionHub.ContentTemplate = (DataTemplate)this.Resources["OptionsTemplate"];

                    optionHub.Header = option.NodeName.Replace("_", " ");
                    itemHub.Sections.Add(optionHub);
                    IXmlNode encode = option.Attributes.GetNamedItem("enCode");
                    IXmlNode limitNode = option.Attributes.GetNamedItem("limit");
                    string limit = limitNode != null ? limitNode.NodeValue.ToString() : "";
                    string en = encode != null ? encode.NodeValue.ToString() : "";
                    optionHub.DataContext = menuItem.menuOptions.getOptions(option.NodeName, en, limit).ToList();
                }
            }

        }
        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)
 {
 }
 /// <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>
 /// 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 async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Create an appropriate data model for your problem domain to replace the sample data
     var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);
     this.DefaultViewModel["Item"] = item;
 }
        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();
        }