public override void Refresh() { _contentClass = null; _ccGuid = default(Guid); _mainLinkElement = null; base.Refresh(); }
private static void BeginLinkElement(ParserContext context, ILinkElement linkElement, List <string> attributes) { if (linkElement != null) { if (attributes == null) { attributes = new List <string>(); } if (!string.IsNullOrEmpty(linkElement.AltText)) { attributes.Add("alt"); attributes.Add(linkElement.AltText); } switch (linkElement.LinkType) { case LinkTypes.Reference: attributes.Add("href"); attributes.Add(linkElement.LinkAddress); context.Template.AddElementOpen("a", attributes.ToArray()); break; case LinkTypes.Image: attributes.Add("src"); attributes.Add(linkElement.LinkAddress); context.Template.AddSelfClosingElement("img", attributes.ToArray()); break; case LinkTypes.Iframe: attributes.Add("src"); attributes.Add(linkElement.LinkAddress); context.Template.AddSelfClosingElement("iframe", attributes.ToArray()); break; } } }
static IStepInvoker CreateInvoker(ILinkElement step) { var behaviorInterface = step.GetType().GetInterfaces().First(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(ILinkElement <,>)); var invokerType = typeof(StepInvoker <,>).MakeGenericType(behaviorInterface.GetGenericArguments()); return((IStepInvoker)Activator.CreateInstance(invokerType)); }
public PageCopyAndConnectJob(IPage page, ILinkElement linkElement, PageCopyAndConnectFlags flags) : base(page.Project) { PageToCopy = page; ConnectionTarget = linkElement; _flags = flags; }
// ReSharper disable once SuggestBaseTypeForParameter /// <code> /// context{i} => link.Invoke(context{i}, context{i+1} => previous) /// </code>> static Delegate CreateLinkCallDelegate(ILinkElement currentBehavior, MethodInfo methodInfo, ParameterExpression outerContextParam, Delegate previous, List <Expression> expressions = null) { Expression body = Expression.Call(Expression.Constant(currentBehavior), methodInfo, outerContextParam, Expression.Constant(previous)); var lambdaExpression = Expression.Lambda(body, outerContextParam); expressions?.Add(lambdaExpression); return(lambdaExpression.Compile()); }
Task InnerInvoke(IncomingContext context, int currentIndex = 0) { if (currentIndex == executingElements.Count) { return(Task.CompletedTask); } ILinkElement step = executingElements[currentIndex]; return(step.Invoke(context, () => InnerInvoke(context, currentIndex + 1))); }
Task InnerInvoke(TransportMessage transportMessage, int currentIndex = 0) { if (currentIndex == linkElements.Count) { return(Task.CompletedTask); } ILinkElement step = linkElements[currentIndex]; return(step.Invoke(transportMessage, () => InnerInvoke(transportMessage, currentIndex + 1))); }
private void ReferenceElement(ILinkElement element) { const string LINK_TO_ELEMENT = @"<PAGE><LINK action=""assign"" guid=""{0}""><LINK guid=""{1}"" /></LINK></PAGE>"; //we can't really check the success, because an empty iodata element is returned on success as on (at least some) errors Project.ExecuteRQL(LINK_TO_ELEMENT.RQLFormat(_element, element)); InvalidateCache(); if (LinkType != LinkType.Reference) { _isNeedingRefresh = true; } }
public ElementInstance(ILinkElement instance) { this.instance = instance; invoker = CreateInvoker(instance); // You would do it smarter IsBefore = instance.GetType().BaseType.Name.StartsWith("Before"); IsAfter = instance.GetType().BaseType.Name.StartsWith("After"); if (IsAfter || IsBefore) return; IsSurround = true; }
public ElementInstance(ILinkElement instance) { this.instance = instance; invoker = CreateInvoker(instance); // You would do it smarter IsBefore = instance.GetType().BaseType.Name.StartsWith("Before"); IsAfter = instance.GetType().BaseType.Name.StartsWith("After"); if (IsAfter || IsBefore) { return; } IsSurround = true; }
IHeadElement IContentModel <IHeadElement, ILinkElement> .this[ILinkElement child] { get { return(this[child]); } }
public void CreateDetailForLink(ILinkElement link, string name) { CreateDetail("LINK", link, name, AuthorizationType.DetailedLink); ForLinks.InvalidateCache(); }
public ElementInstance(ILinkElement instance) { this.instance = instance; invoker = CreateInvoker(instance); }
internal MultiLinkConnections(ILinkElement element, Caching caching) : base(element, caching) { }
public void CopyAndConnectAsync(ILinkElement connectionTarget, PageCopyAndConnectFlags flags = PageCopyAndConnectFlags.None) { CreateCopyAndConnectJob(connectionTarget, flags) .RunAsync(); }
public IPageCopyAndConnectJob CreateCopyAndConnectJob(ILinkElement connectionTarget, PageCopyAndConnectFlags flags = PageCopyAndConnectFlags.None) { return new PageCopyAndConnectJob(this, connectionTarget, flags); }
protected internal LinkConnections(ILinkElement element, Caching caching) : base(caching) { _element = element; RetrieveFunc = GetConnectedPages; }
IHeadElement IContentModel<IHeadElement, ILinkElement>.this[ILinkElement child] { get { return this[child]; } }
static IElementInvoker CreateInvoker(ILinkElement step) { var behaviorInterface = step.GetType().GetInterfaces().First(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(ILinkElement<,>)); var invokerType = typeof(ElementInvoker<,>).MakeGenericType(behaviorInterface.GetGenericArguments()); return (IElementInvoker)Activator.CreateInstance(invokerType); }