/// <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 async void OnNavigatedTo(NavigationEventArgs e) { Random random = new Random(); try { header.Text = MainPage.SelectorHeader; Windows.Web.Http.HttpClient httpClient = new Windows.Web.Http.HttpClient(); string response = await httpClient.GetStringAsync( new Uri(MainPage.ServerLink + "index.php?format=" + MainPage.FromPageParam + "&passCategorie=" + Selector.passCategorie + "&random=" + random.Next().ToString()) ); myClassBinder root = JsonConvert.DeserializeObject <myClassBinder>(response); progress.Opacity = 0; listSelector1.ItemsSource = root.item; if (MainPage.FromPageParam == "help") { MainPage.remember_help_askhelp = true; } } catch (Exception ex) { FadeImageStoryboard.Begin(); imgmoveStoryBoard.Begin(); blockmoveStoryBoard.Begin(); } }
/// <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 async void OnNavigatedTo(NavigationEventArgs e) { //this part is to fill the listbox header.Text = MainPage.SelectorHeader; Random random = new Random();//generate a random number try { //this is the httpClient Windows.Web.Http.HttpClient httpClient = new Windows.Web.Http.HttpClient(); string response = await httpClient.GetStringAsync( new Uri(MainPage.ServerLink + "index.php?format=" + MainPage.FromPageParam + "&random=" + random.Next().ToString()) ); //convert the json format to the list for the listbox myClassBinder root = JsonConvert.DeserializeObject <myClassBinder>(response); progress.Opacity = 0; //binding the listbox to the list listSelector1.ItemsSource = root.item; } catch (Exception ex) { progress.Opacity = 0; FadeImageStoryboard.Begin(); imgmoveStoryBoard.Begin(); blockmoveStoryBoard.Begin(); } }