示例#1
0
 private void StundenplanOpen(object obj)
 {
     _navigation.PushAsync(_viewMapper.Map(App.Services.GetInstance <StundenplanViewModel>()));
 }
示例#2
0
        private NativeView Visit(View view, IShibaContext context)
        {
            var attribute =
                ShibaApp.Instance.ViewMappings.LastOrDefault(it =>
                                                             view.ViewName == it.ViewName);

            if (attribute == null)
            {
                if (ShibaApp.Instance.Components.ContainsKey(view.ViewName))
                {
                    view.Properties.Add(new Property("componentName", view.ViewName));
                    return(ShibaHostMapper.Map(view, context) as ShibaHost);
                }

                return(null);
            }

            var renderer = Renderer.GetOrAdd(attribute.ViewName, type => CreateRenderer(attribute));

            if (context == null)
            {
                throw new ArgumentNullException($"{nameof(context)} can not be null");
            }

            var target = renderer.Map(view, context) as NativeView;

            if (view.Children.Any() && target is NativeViewGroup panel)
            {
                var commonprops = new List <(ShibaView view, NativeView native, List <Property> properties)>();
                view.Children.ForEach(it =>
                {
                    var child = Visit(it, context);
                    if (renderer is IAllowChildViewMapper viewGroupMapper)
                    {
                        viewGroupMapper.AddChild(panel, child);
                    }
                    else
                    {
                        panel.Children.Add(child);
                    }
                    var commonprop = it.Properties.Where(prop =>
                                                         ShibaApp.Instance.Configuration.CommonProperties.Any(cp => cp.Name == prop.Name))
                                     .ToList();
                    if (commonprop.Any())
                    {
                        commonprops.Add((it, child, commonprop));
                    }
                });

                commonprops.ForEach(it =>
                {
                    var(view1, native, properties) = it;
                    properties.ForEach(prop =>
                    {
                        ShibaApp.Instance.Configuration.CommonProperties
                        .Where(cp => cp.Name == prop.Name).ToList()
                        .ForEach(cp => cp.Handle(prop.Value, view1, native, target));
                    });
                });
            }

            return(target);
        }
 public ServerResponse <ProductSearchView> GetList(int skip, int take)
 => _viewMapper.Map(_productService.GetList(skip, take));