コード例 #1
0
        protected internal override void RenderTemplate(ScopedDictionary <string, ValueProviderBase> variables)
        {
            var parent = this.Parent;
            int index  = parent.ChildElements.IndexOf(this);

            this.Remove();

            string str = "@any" + this.ValueProvider.ToString(variables, Operation == null ? null : FilterValueConverter.ToStringOperation(Operation.Value) + Value);

            parent.InsertAt(this.AnyToken.ReplaceMatchNode(str), index++);
            {
                var newVars = new ScopedDictionary <string, ValueProviderBase>(variables);
                ValueProvider.Declare(newVars);
                this.AnyBlock.RenderTemplate(newVars);
                parent.MoveChildsAt(ref index, this.AnyBlock.ChildElements);
            }

            if (this.NotAnyToken.MatchNode != null)
            {
                parent.InsertAt(this.NotAnyToken.ReplaceMatchNode("@notany"), index++);

                var newVars = new ScopedDictionary <string, ValueProviderBase>(variables);
                ValueProvider.Declare(newVars);
                this.NotAnyBlock.RenderTemplate(newVars);
                parent.MoveChildsAt(ref index, this.NotAnyBlock.ChildElements);
            }

            parent.InsertAt(this.EndAnyToken.ReplaceMatchNode("@endany"), index++);
        }
コード例 #2
0
 public override void ToString(StringBuilder sb, ScopedDictionary <string, ValueProviderBase> variables)
 {
     sb.Append("@foreach");
     ValueProvider.ToString(sb, variables, null);
     {
         var newVars = new ScopedDictionary <string, ValueProviderBase>(variables);
         ValueProvider.Declare(newVars);
         Block.ToString(sb, newVars);
     }
     sb.Append("@endforeach");
 }
コード例 #3
0
        protected internal override void RenderTemplate(ScopedDictionary <string, ValueProviderBase> variables)
        {
            var parent = this.Parent;
            int index  = parent.ChildElements.IndexOf(this);

            this.Remove();
            parent.InsertAt(this.ForeachToken.ReplaceMatchNode("@foreach" + this.ValueProvider.ToString(variables, null)), index++);
            {
                var newVars = new ScopedDictionary <string, ValueProviderBase>(variables);
                ValueProvider.Declare(newVars);
                this.ForeachBlock.RenderTemplate(newVars);
                parent.MoveChildsAt(ref index, this.ForeachBlock.ChildElements);
            }
            parent.InsertAt(this.EndForeachToken.ReplaceMatchNode("@endforeach"), index++);
        }
コード例 #4
0
        protected internal override void RenderTemplate(ScopedDictionary <string, ValueProviderBase> variables)
        {
            string str = "@declare" + ValueProvider.ToString(variables, null);

            this.ReplaceBy(this.NodeProvider.NewRun((OpenXmlCompositeElement?)this.RunProperties?.CloneNode(true), str));

            ValueProvider.Declare(variables);
        }
コード例 #5
0
            public override void ToString(StringBuilder sb, ScopedDictionary <string, ValueProviderBase> variables)
            {
                sb.Append("@declare");

                ValueProvider.ToString(sb, variables, null);

                ValueProvider.Declare(variables);
            }
コード例 #6
0
            public override void ToString(StringBuilder sb, ScopedDictionary <string, ValueProviderBase> variables)
            {
                sb.Append("@if");
                ValueProvider.ToString(sb, variables, Operation == null ? null : FilterValueConverter.ToStringOperation(Operation.Value) + Value);
                {
                    var newVars = new ScopedDictionary <string, ValueProviderBase>(variables);
                    ValueProvider.Declare(newVars);
                    IfBlock.ToString(sb, newVars);
                }

                if (ElseBlock != null)
                {
                    sb.Append("@else");
                    var newVars = new ScopedDictionary <string, ValueProviderBase>(variables);
                    ValueProvider.Declare(newVars);
                    ElseBlock.ToString(sb, newVars);
                }

                sb.Append("@endif");
            }
コード例 #7
0
        public override void Synchronize(SynchronizationContext sc)
        {
            ValueProvider.Synchronize(sc, "@");

            ValueProvider.Declare(sc.Variables);
        }