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; }
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>()); }
public ViewDefinition Resolve(ViewDescriptor descriptor) { var policy = _policies.FirstOrDefault(x => x.Matches(descriptor)) ?? _defaultPolicy; return policy.Create(descriptor); }
public SparkViewToken(ViewDescriptor viewDescriptor) { _descriptor = viewDescriptor; }
public ViewEntrySource(ViewDescriptor descriptor, IViewEntryProviderCache provider, IViewDefinitionResolver resolver) { _descriptor = descriptor; _provider = provider; _resolver = resolver; }
public bool Matches(ViewDescriptor descriptor) { return true; }
public virtual ViewDefinition Create(ViewDescriptor descriptor) { return _cache[descriptor]; }