/// <summary> /// Initializes a new instance of a <see cref="QRicketQrCodeProvider"/> with the specified /// <see cref="ErrorCorrectionLevel"/>, <see cref="BackgroundColor"/>, <see cref="ForegroundColor"/>, /// <see cref="QRicketImageFormat">ImageFormat</see> and <see cref="RemoteCertificateValidationCallback"/>. /// </summary> /// <param name="errorCorrectionLevel">The <see cref="ErrorCorrectionLevel"/> to use when generating QR codes.</param> /// <param name="backgroundColor">The background color to be used for the QR code.</param> /// <param name="foregroundColor">The foreground color to be used for the QR code.</param> /// <param name="imageFormat">The <see cref="QRicketImageFormat"/> of the QR code.</param> /// <param name="remoteCertificateValidationCallback"> /// The <see cref="RemoteCertificateValidationCallback"/> to use when generating QR codes. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown when an invalid <see cref="ErrorCorrectionLevel"/> or <see cref="QRicketImageFormat"/> is specified. /// </exception> public QRicketQrCodeProvider(ErrorCorrectionLevel errorCorrectionLevel, Color backgroundColor, Color foregroundColor, QRicketImageFormat imageFormat, RemoteCertificateValidationCallback remoteCertificateValidationCallback) : base(baseuri, remoteCertificateValidationCallback) { if (!Enum.IsDefined(typeof(ErrorCorrectionLevel), errorCorrectionLevel)) { throw new ArgumentOutOfRangeException("errorCorrectionLevel"); } this.ErrorCorrectionLevel = errorCorrectionLevel; this.BackgroundColor = backgroundColor; this.ForegroundColor = foregroundColor; if (!Enum.IsDefined(typeof(QRicketImageFormat), imageFormat)) { throw new ArgumentOutOfRangeException("imageFormat"); } this.ImageFormat = imageFormat; }
/// <summary> /// Initializes a new instance of a <see cref="QRicketQrCodeProvider"/> with the specified /// <see cref="ErrorCorrectionLevel"/>, <see cref="BackgroundColor"/>, <see cref="ForegroundColor"/>, /// <see cref="QRicketImageFormat">ImageFormat</see> and <see cref="RemoteCertificateValidationCallback"/>. /// </summary> /// <param name="errorCorrectionLevel">The <see cref="ErrorCorrectionLevel"/> to use when generating QR codes.</param> /// <param name="backgroundColor">The background color to be used for the QR code.</param> /// <param name="foregroundColor">The foreground color to be used for the QR code.</param> /// <param name="imageFormat">The <see cref="QRicketImageFormat"/> of the QR code.</param> /// <param name="remoteCertificateValidationCallback"> /// The <see cref="RemoteCertificateValidationCallback"/> to use when generating QR codes. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown when an invalid <see cref="ErrorCorrectionLevel"/> or <see cref="QRicketImageFormat"/> is specified. /// </exception> public QRicketQrCodeProvider( ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.Low, Color?backgroundColor = null, Color?foregroundColor = null, QRicketImageFormat imageFormat = QRicketImageFormat.Png, RemoteCertificateValidationCallback remoteCertificateValidationCallback = null ) : base(baseuri, remoteCertificateValidationCallback) { if (!Enum.IsDefined(typeof(ErrorCorrectionLevel), errorCorrectionLevel)) { throw new ArgumentOutOfRangeException(nameof(errorCorrectionLevel)); } ErrorCorrectionLevel = errorCorrectionLevel; BackgroundColor = backgroundColor ?? Color.White; ForegroundColor = foregroundColor ?? Color.Black; if (!Enum.IsDefined(typeof(QRicketImageFormat), imageFormat)) { throw new ArgumentOutOfRangeException(nameof(imageFormat)); } ImageFormat = imageFormat; }
/// <summary> /// Initializes a new instance of a <see cref="QRicketQrCodeProvider"/> with the specified /// <see cref="ErrorCorrectionLevel"/>, <see cref="BackgroundColor"/>, <see cref="ForegroundColor"/>, /// <see cref="QRicketImageFormat">ImageFormat</see> and <see cref="RemoteCertificateValidationCallback"/>. /// </summary> /// <param name="errorCorrectionLevel">The <see cref="ErrorCorrectionLevel"/> to use when generating QR codes.</param> /// <param name="backgroundColor">The background color to be used for the QR code.</param> /// <param name="foregroundColor">The foreground color to be used for the QR code.</param> /// <param name="imageFormat">The <see cref="QRicketImageFormat"/> of the QR code.</param> /// <param name="remoteCertificateValidationCallback"> /// The <see cref="RemoteCertificateValidationCallback"/> to use when generating QR codes. /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// Thrown when an invalid <see cref="ErrorCorrectionLevel"/> or <see cref="QRicketImageFormat"/> is specified. /// </exception> public QRicketQrCodeProvider(ErrorCorrectionLevel errorCorrectionLevel, Color backgroundColor, Color foregroundColor, QRicketImageFormat imageFormat, RemoteCertificateValidationCallback remoteCertificateValidationCallback) : base(baseuri, remoteCertificateValidationCallback) { if (!Enum.IsDefined(typeof(ErrorCorrectionLevel), errorCorrectionLevel)) throw new ArgumentOutOfRangeException("errorCorrectionLevel"); this.ErrorCorrectionLevel = errorCorrectionLevel; this.BackgroundColor = backgroundColor; this.ForegroundColor = foregroundColor; if (!Enum.IsDefined(typeof(QRicketImageFormat), imageFormat)) throw new ArgumentOutOfRangeException("imageFormat"); this.ImageFormat = imageFormat; }
/// <summary> /// Initializes a new instance of a <see cref="QRicketQrCodeProvider"/> with the specified /// <see cref="ErrorCorrectionLevel"/>, <see cref="BackgroundColor"/>, <see cref="ForegroundColor"/>, /// <see cref="QRicketImageFormat">ImageFormat</see> and default /// <see cref="RemoteCertificateValidationCallback"/>. /// </summary> /// <param name="errorCorrectionLevel">The <see cref="ErrorCorrectionLevel"/> to use when generating QR codes.</param> /// <param name="backgroundColor">The background color to be used for the QR code.</param> /// <param name="foregroundColor">The foreground color to be used for the QR code.</param> /// <param name="imageFormat">The <see cref="QRicketImageFormat"/> of the QR code.</param> public QRicketQrCodeProvider(ErrorCorrectionLevel errorCorrectionLevel, Color backgroundColor, Color foregroundColor, QRicketImageFormat imageFormat) : this(errorCorrectionLevel, backgroundColor, foregroundColor, imageFormat, null) { }