private void ParseDetailItems <TSchema>(DetailPageConfig <TSchema> detailConfig, CachedContent <TSchema> content, ItemViewModel selectedItem) where TSchema : SchemaBase { TSchema sourceSelected; ParseDetailItems(detailConfig, content, selectedItem, out sourceSelected); }
private void ParseDetailItems <TSchema>(DetailPageConfig <TSchema> detailConfig, CachedContent <TSchema> content, ItemViewModel selectedItem, out TSchema sourceSelected) where TSchema : SchemaBase { sourceSelected = content.Items.FirstOrDefault(i => i._id == selectedItem.Id); foreach (var item in content.Items) { var composedItem = new ComposedItemViewModel { Id = item._id }; foreach (var binding in detailConfig.LayoutBindings) { var parsedItem = new ItemViewModel { Id = item._id }; binding(parsedItem, item); composedItem.Add(parsedItem); } composedItem.Actions = detailConfig.Actions .Select(a => new ActionInfo { Command = a.Command, CommandParameter = a.CommandParameter(item), Style = a.Style, Text = a.Text, ActionType = ActionType.Primary }) .ToList(); Items.Add(composedItem); } if (selectedItem != null) { SelectedItem = Items.FirstOrDefault(i => i.Id == selectedItem.Id); } }
protected override void ParseItems(CachedContent <TouchDevelopSchema> content, ItemViewModel selectedItem) { Items.Clear(); foreach (var item in content.Items) { Items.Add(item); } }