示例#1
0
        /// <summary>
        /// Generates a QR image file with the specified message and <see cref="BarcodeGenerationConfiguration"/>.
        /// </summary>
        /// <remarks>
        ///     <see cref="BarcodeGenerationConfiguration.TextVisibility"/> must be <see cref="Visibility.Invisible"/>,
        ///     because the text visibility is not supported in the QR code.
        /// </remarks>
        /// <param name="message">The message to be encoded in the barcode.</param>
        /// <param name="qrConfig">The <see cref="QrConfiguration"/> instance.</param>
        /// <param name="imageConfig">The <see cref="BarcodeImageConfiguration"/> that contains
        ///     information about the file to be generated.</param>
        /// <param name="config">The configuration of the barcode generator. This value can be null.</param>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="message"/> is null.<br/>
        ///     -or-<br/>
        ///     <paramref name="qrConfig"/> is null.<br/>
        ///     -or-<br/>
        ///     <paramref name="imageConfig"/> is null.
        /// </exception>
        /// <exception cref="ArgumentException">
        ///     <paramref name="message"/> is too long.<br/>
        ///     -or-<br/>
        ///     <paramref name="message"/> contains characters which are illegal by the <see cref="QrMode"/>.
        /// </exception>
        /// <exception cref="UnauthorizedAccessException">No permission to write a file.</exception>
        /// <exception cref="NotSupportedException">
        ///     The feature is not supported.<br/>
        ///     -or-<br/>
        ///     <see cref="BarcodeGenerationConfiguration.TextVisibility"/> is the <see cref="Visibility.Visible"/>.
        /// </exception>
        /// <exception cref="ObjectDisposedException"><paramref name="config"/> already has been disposed of.</exception>
        /// <since_tizen> 4 </since_tizen>
        public static void GenerateImage(string message, QrConfiguration qrConfig,
                                         BarcodeImageConfiguration imageConfig, BarcodeGenerationConfiguration config)
        {
            if (qrConfig == null)
            {
                throw new ArgumentNullException(nameof(qrConfig));
            }

            if (config != null)
            {
                if (config.TextVisibility == Visibility.Visible)
                {
                    throw new NotSupportedException("Text can't be visible in QR.");
                }
            }

            GenerateImage(config, message, BarcodeType.QR, imageConfig, (int)qrConfig.Mode,
                          (int)qrConfig.ErrorCorrectionLevel, qrConfig.Version);
        }
示例#2
0
 /// <summary>
 /// Generates a QR image with the specified message.
 /// </summary>
 /// <param name="message">The message to be encoded in the barcode.</param>
 /// <param name="qrConfig">The <see cref="QrConfiguration"/> instance.</param>
 /// <returns><see cref="MediaVisionSource"/> containing the generated QR image.</returns>
 /// <exception cref="ArgumentNullException">
 ///     <paramref name="qrConfig"/> is null.<br/>
 ///     -or-<br/>
 ///     <paramref name="message"/> is null.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///     <paramref name="message"/> is too long.<br/>
 ///     -or-<br/>
 ///     <paramref name="message"/> contains characters which are illegal by the <see cref="QrMode"/>.
 ///     </exception>
 /// <exception cref="NotSupportedException">The feature is not supported.</exception>
 /// <seealso cref="QrMode"/>
 /// <since_tizen> 4 </since_tizen>
 public static MediaVisionSource GenerateSource(string message, QrConfiguration qrConfig)
 {
     return(GenerateSource(message, qrConfig, null));
 }
示例#3
0
 /// <summary>
 /// Generates a QR image file with the specified message.
 /// </summary>
 /// <remarks>
 ///     <see cref="BarcodeGenerationConfiguration.TextVisibility"/> must be <see cref="Visibility.Invisible"/>,
 ///     because the text visibility is not supported in the QR code.
 /// </remarks>
 /// <param name="message">The message to be encoded in the barcode.</param>
 /// <param name="qrConfig">The <see cref="QrConfiguration"/> instance.</param>
 /// <param name="imageConfig">The <see cref="BarcodeImageConfiguration"/> that contains information about the file to be generated.</param>
 /// <exception cref="ArgumentNullException">
 ///     <paramref name="message"/> is null.<br/>
 ///     -or-<br/>
 ///     <paramref name="qrConfig"/> is null.<br/>
 ///     -or-<br/>
 ///     <paramref name="imageConfig"/> is null.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///     <paramref name="message"/> is too long.<br/>
 ///     -or-<br/>
 ///     <paramref name="message"/> contains characters which are illegal by the <see cref="QrMode"/>.
 /// </exception>
 /// <exception cref="UnauthorizedAccessException">No permission to write a file.</exception>
 /// <exception cref="NotSupportedException">The feature is not supported.</exception>
 /// <seealso cref="QrMode"/>
 /// <since_tizen> 4 </since_tizen>
 public static void GenerateImage(string message, QrConfiguration qrConfig,
                                  BarcodeImageConfiguration imageConfig)
 {
     GenerateImage(message, qrConfig, imageConfig, null);
 }