public void randomDailyRecipe() { Random random = new Random(); int idx = random.Next(listboxItems.Count); dailyRecipe = listboxItems[idx]; }
protected override void OnNavigatedTo(NavigationEventArgs e) { MainListboxModel model = e.Parameter as MainListboxModel; //recipeTitle.Text = recipe.title; loadRecipe(model.id); }
private void btn_daily_Click(object sender, RoutedEventArgs e) { recipeController.randomDailyRecipe(); UpdateTile(recipeController.getDailyRecipe()); MainListboxModel model = (MainListboxModel)recipeController.getDailyRecipe(); this.Frame.Navigate(typeof(RecipePageImproved), model); }
// Click events private void navigateToRecipePage(object sender, SelectionChangedEventArgs e) { if (sender.GetType() == typeof(ListView)) { ListView listView = (ListView)sender; MainListboxModel model = (MainListboxModel)listView.Items[listView.SelectedIndex]; this.Frame.Navigate(typeof(RecipePageImproved), model); } }
private void UpdateTile(MainListboxModel item) { var updater = TileUpdateManager.CreateTileUpdaterForApplication(); updater.EnableNotificationQueue(true); updater.Clear(); Windows.Data.Xml.Dom.XmlDocument xml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150PeekImageAndText01); xml.GetElementsByTagName("text")[0].InnerText = item.title; xml.GetElementsByTagName("text")[1].InnerText = item.subtitle; xml.GetElementsByTagName("text")[3].InnerText = "Heerlijk " + item.category; XmlNodeList squareImageElements = xml.GetElementsByTagName("image"); XmlElement squareImageElement = (XmlElement)squareImageElements.Item(0); squareImageElement.SetAttribute("src", imgUrl + item.image); updater.Update(new TileNotification(xml)); }