示例#1
0
        private static SparkViewDescriptor createSparkDescriptor(bool useMaster, ViewDescriptor viewDescriptor)
        {
            var sparkDescriptor = new SparkViewDescriptor().AddTemplate(viewDescriptor.ViewPath);
            if (useMaster && viewDescriptor.Master != null)
            {
                appendMasterPage(sparkDescriptor, viewDescriptor.Master);
            }

            return sparkDescriptor;
        }
示例#2
0
        public void SetUp()
        {
            var root = AppDomain.CurrentDomain.BaseDirectory;
            _template = new Template(Path.Combine(root, "Views", "Home", "Home.spark"), root, FubuSparkConstants.HostOrigin);

            _descriptor = new ViewDescriptor(_template)
            {
                Namespace = String.Join(".", new[] {GetType().Name, "Views", "Home"}),
                ViewModel = typeof (ProductModel)
            };

            _template.Descriptor = _descriptor;

            _token = new SparkViewToken(_template.Descriptor.As<ViewDescriptor>());
        }
示例#3
0
 public ViewDefinition Resolve(ViewDescriptor descriptor)
 {
     var policy = _policies.FirstOrDefault(x => x.Matches(descriptor)) ?? _defaultPolicy;
     return policy.Create(descriptor);
 }
示例#4
0
 public SparkViewToken(ViewDescriptor viewDescriptor)
 {
     _descriptor = viewDescriptor;
 }
示例#5
0
 public ViewEntrySource(ViewDescriptor descriptor, IViewEntryProviderCache provider, IViewDefinitionResolver resolver)
 {
     _descriptor = descriptor;
     _provider = provider;
     _resolver = resolver;
 }
示例#6
0
 public bool Matches(ViewDescriptor descriptor)
 {
     return true;
 }
示例#7
0
 public virtual ViewDefinition Create(ViewDescriptor descriptor)
 {
     return _cache[descriptor];
 }