private void LoadItem(int itemId) { var group = APIMASH_StackExchangeCollection.GetGroupByTitle("All"); Item = APIMASH_StackExchangeCollection.GetItem(itemId); DisplayName = ""; }
/// <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="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // TODO: Assign a bindable collection of items to this.DefaultViewModel["Items"] var group = APIMASH_StackExchangeCollection.GetGroupById((String)navigationParameter); this.DefaultViewModel["Group"] = group; this.DefaultViewModel["Items"] = group.Items; }
protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { this.DefaultViewModel["Groups"] = APIMASH_StackExchangeCollection.GetGroups((String)navigationParameter);; if (!_loaded) { Invoke(); } }
void api_OnResponse(object sender, APIMASHEvent e) { StackExchangeQuestions response = (StackExchangeQuestions)e.Object; if (e.Status == APIMASHStatus.SUCCESS) { // copy data into bindable format for UI APIMASH_StackExchangeCollection.Copy(response, System.Guid.NewGuid().ToString(), "All"); Items = APIMASH_StackExchangeCollection.GetGroups("AllGroups").FirstOrDefault().Items; } }
async private void apiInvoke_OnResponse(object sender, APIMASHEvent e) { StackExchangeQuestions response = (StackExchangeQuestions)e.Object; if (e.Status == APIMASHStatus.SUCCESS) { // copy data into bindable format for UI APIMASH_StackExchangeCollection.Copy(response, System.Guid.NewGuid().ToString(), "All"); this.DefaultViewModel["AllGroups"] = APIMASH_StackExchangeCollection.GetGroups("AllGroups"); _loaded = true; } else { var md = new MessageDialog(e.Message, "Error"); md.Commands.Add(new UICommand("Ok", new UICommandInvokedHandler((cmd) => { }))); await md.ShowAsync(); } }
/// <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="navigationParameter">The parameter value passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested. /// </param> /// <param name="pageState">A dictionary of state preserved by this page during an earlier /// session. This will be null the first time a page is visited.</param> protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState) { // Allow saved page state to override the initial item to display if (pageState != null && pageState.ContainsKey("SelectedItem")) { navigationParameter = pageState["SelectedItem"]; } // TODO: Assign a bindable group to this.DefaultViewModel["Group"] // TODO: Assign a collection of bindable items to this.DefaultViewModel["Items"] // TODO: Assign the selected item to this.flipView.SelectedItem var group = APIMASH_StackExchangeCollection.GetGroupByTitle("All"); var item = APIMASH_StackExchangeCollection.GetItem((int)navigationParameter); DefaultViewModel["Group"] = group; DefaultViewModel["Items"] = group.Items; this.flipView.SelectedItem = item; QuestionContent.NavigateToString(item.Body); }