/// <summary>
 /// Overridden. Gets a textual representation of the build URI.
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     if (EncodingScheme == BarcodeSymbology.CodeQr)
     {
         return(BarcodeImageUriBuilder.GetFileNameFromQrParams(
                    Text, Scale, UseExtensionlessUri,
                    QrEncodingMode, QrErrorCorrect, QrVersion));
     }
     else
     {
         return(BarcodeImageUriBuilder.GetFileNameFromParams(
                    Text, Scale, UseExtensionlessUri,
                    EncodingScheme, BarMinHeight, BarMaxHeight, BarMinWidth, BarMaxWidth));
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Prepares our composite controls for rendering by setting
        /// last-minute (ie: non-viewstate tracked) properties.
        /// </summary>
        protected virtual void PrepareControlHierarchy()
        {
            if (Controls.Count > 0)
            {
                // Setup base table control style
                Table table = (Table)Controls[0];
                table.CopyBaseAttributes(this);
                if (ControlStyleCreated && !ControlStyle.IsEmpty)
                {
                    table.ApplyStyle(ControlStyle);
                }
                else
                {
                    table.GridLines   = GridLines.None;
                    table.CellPadding = 10;
                    table.CellSpacing = 0;
                }

                // Setup label controls.
                TableRow labelRowTop    = (TableRow)FindControl("labelRowTop");
                TableRow labelRowBottom = (TableRow)FindControl("labelRowBottom");
                labelRowTop.Visible    = false;
                labelRowBottom.Visible = false;
                if (ShowLabel)
                {
                    // Setup label row style
                    TableItemStyle style = new TableItemStyle();
                    style.CopyFrom(LabelRowStyle);
                    style.HorizontalAlign = LabelHorizontalAlign;

                    // Setup appropriate row
                    if (LabelVerticalAlign == VerticalAlign.Top)
                    {
                        labelRowTop.MergeStyle(style);
                        labelRowTop.Visible = true;

                        TableCell labelCell = (TableCell)FindControl("labelCellTop");
                        labelCell.Text = Text;
                    }
                    else
                    {
                        labelRowBottom.MergeStyle(style);
                        labelRowBottom.Visible = true;

                        TableCell labelCell = (TableCell)FindControl("labelCellBottom");
                        labelCell.Text = Text;
                    }
                }

                // Setup barcode row style
                TableRow barcodeRow = (TableRow)FindControl("barcodeRow");
                barcodeRow.MergeStyle(BarcodeRowStyle);

                // Setup barcode image url
                BarcodeImageUriBuilder builder = new BarcodeImageUriBuilder();
                builder.Text           = Text;
                builder.Scale          = Scale;
                builder.EncodingScheme = BarcodeEncoding;
                builder.BarMinHeight   = BarMinHeight;
                builder.BarMaxHeight   = BarMaxHeight;
                builder.BarMinWidth    = BarMinWidth;
                builder.BarMaxWidth    = BarMaxWidth;
                Image barcodeImage = (Image)FindControl("barcodeImage");
                barcodeImage.ImageUrl = builder.ToString();
            }
        }
 /// <summary>
 /// Overridden. Gets a textual representation of the build URI.
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(BarcodeImageUriBuilder.GetFileNameFromParams(Text,
                                                         (int)EncodingScheme, BarMinHeight, BarMaxHeight,
                                                         BarMinWidth, BarMaxWidth));
 }
Esempio n. 4
0
        /// <summary>
        /// Prepares our composite controls for rendering by setting
        /// last-minute (ie: non-viewstate tracked) properties.
        /// </summary>
        protected virtual void PrepareControlHierarchy()
        {
            if (Controls.Count > 0)
            {
                // Setup base table control style
                Table table = (Table)Controls[0];
                table.CopyBaseAttributes(this);
                if (ControlStyleCreated && !ControlStyle.IsEmpty)
                {
                    table.ApplyStyle(ControlStyle);
                }
                else
                {
                    table.GridLines = GridLines.None;
                    table.CellPadding = 10;
                    table.CellSpacing = 0;
                }

                // Setup label controls.
                TableRow labelRowTop = (TableRow)FindControl("labelRowTop");
                TableRow labelRowBottom = (TableRow)FindControl("labelRowBottom");
                labelRowTop.Visible = false;
                labelRowBottom.Visible = false;
                if (ShowLabel)
                {
                    // Setup label row style
                    TableItemStyle style = new TableItemStyle();
                    style.CopyFrom(LabelRowStyle);
                    style.HorizontalAlign = LabelHorizontalAlign;

                    // Setup appropriate row
                    if (LabelVerticalAlign == VerticalAlign.Top)
                    {
                        labelRowTop.MergeStyle(style);
                        labelRowTop.Visible = true;

                        TableCell labelCell = (TableCell)FindControl("labelCellTop");
                        labelCell.Text = Text;
                    }
                    else
                    {
                        labelRowBottom.MergeStyle(style);
                        labelRowBottom.Visible = true;

                        TableCell labelCell = (TableCell)FindControl("labelCellBottom");
                        labelCell.Text = Text;
                    }
                }

                // Setup barcode row style
                TableRow barcodeRow = (TableRow)FindControl("barcodeRow");
                barcodeRow.MergeStyle(BarcodeRowStyle);

                // Setup barcode image url
                BarcodeImageUriBuilder builder = new BarcodeImageUriBuilder();
                builder.Text = Text;
                builder.Scale = Scale;
                builder.EncodingScheme = BarcodeEncoding;
                builder.BarMinHeight = BarMinHeight;
                builder.BarMaxHeight = BarMaxHeight;
                builder.BarMinWidth = BarMinWidth;
                builder.BarMaxWidth = BarMaxWidth;
                Image barcodeImage = (Image)FindControl("barcodeImage");
                barcodeImage.ImageUrl = builder.ToString();
            }
        }