示例#1
0
文件: Barcode.cs 项目: wanaxe/Study
        public override void WriteInitializationScript(TextWriter writer)
        {
            var options = new Dictionary<string, object>(Events);

            options["type"] = this.Encoding;

            if (this.Encoding == BarcodeSymbology.GS1128)
            {
                options["type"] = "gs1-128";
            }

            if (this.Checksum == false)
            {
                options["checksum"] = this.Checksum;
            }

            if (Value.HasValue())
            {
                options["value"] = Value;
            }

            if (RenderAs.HasValue)
            {
                options["renderAs"] = RenderAs.ToString().ToLowerInvariant();
            }

            if (Background.HasValue())
            {
                options["background"] = Background;
            }

            if (Color.HasValue())
            {
                options["color"] = Color;
            }

            if (Height.HasValue)
            {
                options["height"] = Height;
            }

            if (Width.HasValue)
            {
                options["width"] = Width;
            }

            if (this.Border.Color.HasValue() || this.Border.DashType !=  null ||
                this.Border.Width.HasValue)
            {
                options["border"] = new BarcodeElementBorderSerializer(this.Border).Serialize();
            }

            if (this.Padding.ShouldSerialize())
            {
                options["padding"] = this.Padding.CreateSerializer().Serialize();
            }

            if (this.Text.ShouldSerialize())
            {
                options["text"] = this.Text.ToJson();
            }

            writer.Write(Initializer.Initialize(Selector, "Barcode", options));

            base.WriteInitializationScript(writer);
        }
示例#2
0
文件: Barcode.cs 项目: wanaxe/Study
        public override void WriteInitializationScript(TextWriter writer)
        {
            var options = new Dictionary <string, object>(Events);

            options["type"] = this.Encoding;

            if (this.Encoding == BarcodeSymbology.GS1128)
            {
                options["type"] = "gs1-128";
            }

            if (this.Checksum == false)
            {
                options["checksum"] = this.Checksum;
            }

            if (Value.HasValue())
            {
                options["value"] = Value;
            }

            if (RenderAs.HasValue)
            {
                options["renderAs"] = RenderAs.ToString().ToLowerInvariant();
            }

            if (Background.HasValue())
            {
                options["background"] = Background;
            }

            if (Color.HasValue())
            {
                options["color"] = Color;
            }

            if (Height.HasValue)
            {
                options["height"] = Height;
            }

            if (Width.HasValue)
            {
                options["width"] = Width;
            }

            if (this.Border.Color.HasValue() || this.Border.DashType != null ||
                this.Border.Width.HasValue)
            {
                options["border"] = new BarcodeElementBorderSerializer(this.Border).Serialize();
            }

            if (this.Padding.ShouldSerialize())
            {
                options["padding"] = this.Padding.CreateSerializer().Serialize();
            }

            if (this.Text.ShouldSerialize())
            {
                options["text"] = this.Text.ToJson();
            }

            writer.Write(Initializer.Initialize(Selector, "Barcode", options));

            base.WriteInitializationScript(writer);
        }