Example #1
0
 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;
                }
            }
        }
Example #3
0
        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;
 }
Example #5
0
        // 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());
        }
Example #6
0
        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)));
        }
Example #7
0
        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;
        }
Example #10
0
        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]); }
 }
Example #12
0
 public PageCopyAndConnectJob(IPage page, ILinkElement linkElement, PageCopyAndConnectFlags flags) : base(page.Project)
 {
     PageToCopy       = page;
     ConnectionTarget = linkElement;
     _flags           = flags;
 }
 public void CreateDetailForLink(ILinkElement link, string name)
 {
     CreateDetail("LINK", link, name, AuthorizationType.DetailedLink);
     ForLinks.InvalidateCache();
 }
Example #14
0
 public ElementInstance(ILinkElement instance)
 {
     this.instance = instance;
     invoker       = CreateInvoker(instance);
 }
Example #15
0
 internal MultiLinkConnections(ILinkElement element, Caching caching)
     : base(element, caching)
 {
 }
Example #16
0
 public void CopyAndConnectAsync(ILinkElement connectionTarget, PageCopyAndConnectFlags flags = PageCopyAndConnectFlags.None)
 {
     CreateCopyAndConnectJob(connectionTarget, flags)
         .RunAsync();
 }
Example #17
0
 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;
 }
Example #19
0
 public void CopyAndConnectAsync(ILinkElement connectionTarget, PageCopyAndConnectFlags flags = PageCopyAndConnectFlags.None)
 {
     CreateCopyAndConnectJob(connectionTarget, flags)
         .RunAsync();
 }
Example #20
0
 public IPageCopyAndConnectJob CreateCopyAndConnectJob(ILinkElement connectionTarget,
                                                       PageCopyAndConnectFlags flags = PageCopyAndConnectFlags.None)
 {
     return new PageCopyAndConnectJob(this, connectionTarget, flags);
 }
Example #21
0
 public override void Refresh()
 {
     _contentClass = null;
     _ccGuid = default(Guid);
     _mainLinkElement = null;
     base.Refresh();
 }
Example #22
0
 IHeadElement IContentModel<IHeadElement, ILinkElement>.this[ILinkElement child]
 {
     get { return this[child]; }
 }
 internal MultiLinkConnections(ILinkElement element, Caching caching) : base(element, caching)
 {
 }
 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);
 }
 public ElementInstance(ILinkElement instance)
 {
     this.instance = instance;
     invoker = CreateInvoker(instance);
 }