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);
            }
        }
Beispiel #2
0
        protected override void ParseItems(CachedContent <TSchema> content, ItemViewModel selectedItem)
        {
            foreach (var item in content.Items)
            {
                var composedItem = new ComposedItemViewModel
                {
                    Id = item._id
                };

                foreach (var binding in _sectionConfig.DetailPage.LayoutBindings)
                {
                    var parsedItem = new ItemViewModel
                    {
                        Id = item._id
                    };
                    binding(parsedItem, item);

                    composedItem.Add(parsedItem);
                }

                composedItem.Actions = _sectionConfig.DetailPage.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);
            }
        }