public QMGenerateQueue(string action)
        {
            this.connect = ConnectDatabase.getInstance();
            this.action  = action;
            Guid   g          = Guid.NewGuid();
            string GuidString = Convert.ToBase64String(g.ToByteArray());

            GuidString = GuidString.Replace("=", "");
            GuidString = GuidString.Replace("+", "");
            InitializeComponent();
            label.Content = action;
            QRCodeGenerator qrGenerator  = new QRCodeGenerator();
            QRCodeData      qrCodeData   = qrGenerator.CreateQrCode(GuidString, QRCodeGenerator.ECCLevel.H);
            XamlQRCode      qrCode       = new XamlQRCode(qrCodeData);
            DrawingImage    qrCodeAsXaml = qrCode.GetGraphic(20);

            qrcode.Source = qrCodeAsXaml;
            if (action.Equals("Teller"))
            {
                DataTable dt = new DataTable();
                dt = connect.executeQuery("select * from queue where division = 'Teller'");
                connect.executeUpdate("insert into queue values ('A" + (dt.Rows.Count + 1).ToString() + "', '" + GuidString + "', 'Teller', 'Not Done')");
                queueno.Content = 'A' + (dt.Rows.Count + 1).ToString();
            }
            else
            {
                DataTable dt = new DataTable();
                dt = connect.executeQuery("select * from queue where division = 'Customer Service'");
                connect.executeUpdate("insert into queue values ('B" + (dt.Rows.Count + 1).ToString() + "', '" + GuidString + "', 'Customer Service', 'Not Done')");
                queueno.Content = 'B' + (dt.Rows.Count + 1).ToString();
            }
        }
    private void BtnGenerate_Click(object sender, RoutedEventArgs e)
    {
        QRCodeGenerator qrGenerator  = new QRCodeGenerator();
        QRCodeData      qrCodeData   = qrGenerator.CreateQrCode(inputBox.Text, QRCodeGenerator.ECCLevel.H);
        XamlQRCode      qrCode       = new XamlQRCode(qrCodeData);
        DrawingImage    qrCodeAsXaml = qrCode.GetGraphic(20);

        qrImage.Source = qrCodeAsXaml;
    }
Пример #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            QRCodeGenerator qrGenerator  = new QRCodeGenerator();
            QRCodeData      qrCodeData   = qrGenerator.CreateQrCode("Hossain Ahmed,Jeasan Ahmed , SK Farhan khan, MR. Asad Ullah Al-Galib", QRCodeGenerator.ECCLevel.H);
            XamlQRCode      qrCode       = new XamlQRCode(qrCodeData);
            DrawingImage    qrCodeAsXaml = qrCode.GetGraphic(10);

            qrImage.Source = qrCodeAsXaml;
        }
Пример #4
0
        public static System.Windows.Media.DrawingImage WorkForSVG(string text, double MBLConfigureQRWH)
        {
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            QRCodeData      qrCodeData  = qrGenerator.CreateQrCode(text, QRCodeGenerator.ECCLevel.H);
            XamlQRCode      qrCode      = new XamlQRCode(qrCodeData);

            System.Windows.Size size = new System.Windows.Size((int)MBLConfigureQRWH * MBXUtils.Type, (int)MBLConfigureQRWH * MBXUtils.Type);
            System.Windows.Media.DrawingImage qrCodeAsXaml = qrCode.GetGraphic(size, false);
            return(qrCodeAsXaml);
        }
Пример #5
0
        internal static System.Windows.Media.DrawingImage WorkForSVG(string text, int wh)
        {
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            QRCodeData      qrCodeData  = qrGenerator.CreateQrCode(text, QRCodeGenerator.ECCLevel.H);
            XamlQRCode      qrCode      = new XamlQRCode(qrCodeData);

            System.Windows.Size size = new System.Windows.Size(wh * UIUtils.Type, wh * UIUtils.Type);
            System.Windows.Media.DrawingImage qrCodeAsXaml = qrCode.GetGraphic(size, false);
            return(qrCodeAsXaml);
        }
Пример #6
0
        public QRCode(Employee emp)
        {
            this.tq       = TellerQueue.getInstance();
            this.employee = emp;
            InitializeComponent();
            QRCodeGenerator qrGenerator  = new QRCodeGenerator();
            QRCodeData      qrCodeData   = qrGenerator.CreateQrCode(tq.uniquequeue, QRCodeGenerator.ECCLevel.H);
            XamlQRCode      qrCode       = new XamlQRCode(qrCodeData);
            DrawingImage    qrCodeAsXaml = qrCode.GetGraphic(20);

            qrcode.Source = qrCodeAsXaml;
        }
Пример #7
0
        private static void GenerateQRCode(string payloadString, QRCodeGenerator.ECCLevel eccLevel, string outputFileName, SupportedImageFormat imgFormat, int pixelsPerModule, string foreground, string background)
        {
            using (var generator = new QRCodeGenerator())
            {
                using (var data = generator.CreateQrCode(payloadString, eccLevel))
                {
                    switch (imgFormat)
                    {
                    case SupportedImageFormat.Png:
                    case SupportedImageFormat.Jpg:
                    case SupportedImageFormat.Gif:
                    case SupportedImageFormat.Bmp:
                    case SupportedImageFormat.Tiff:
                        using (var code = new QRCode(data))
                        {
                            using (var bitmap = code.GetGraphic(pixelsPerModule, foreground, background, true))
                            {
                                var actualFormat = new OptionSetter().GetImageFormat(imgFormat.ToString());
                                bitmap.Save(outputFileName, actualFormat);
                            }
                        }
                        break;

                    case SupportedImageFormat.Svg:
                        using (var code = new SvgQRCode(data))
                        {
                            var test = code.GetGraphic(pixelsPerModule, foreground, background, true);
                            using (var f = File.CreateText(outputFileName))
                            {
                                f.Write(test);
                                f.Flush();
                            }
                        }
                        break;

                    case SupportedImageFormat.Xaml:
                        using (var code = new XamlQRCode(data))
                        {
                            var test = XamlWriter.Save(code.GetGraphic(pixelsPerModule, foreground, background, true));
                            using (var f = File.CreateText(outputFileName))
                            {
                                f.Write(test);
                                f.Flush();
                            }
                        }
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(imgFormat), imgFormat, null);
                    }
                }
            }
        }
Пример #8
0
        public CSQRCode(Employee emp, Customer cust)
        {
            this.csq      = CSQueue.getInstance();
            this.employee = emp;
            this.customer = cust;
            InitializeComponent();
            QRCodeGenerator qrGenerator  = new QRCodeGenerator();
            QRCodeData      qrCodeData   = qrGenerator.CreateQrCode(csq.uniquequeue, QRCodeGenerator.ECCLevel.H);
            XamlQRCode      qrCode       = new XamlQRCode(qrCodeData);
            DrawingImage    qrCodeAsXaml = qrCode.GetGraphic(20);

            qrcode.Source = qrCodeAsXaml;
        }
Пример #9
0
 private void GenerarQR()
 {
     try
     {
         QRCodeGenerator qrGenerator  = new QRCodeGenerator();
         QRCodeData      qrCodeData   = qrGenerator.CreateQrCode(clienteIp.PadRight(15, 'x'), QRCodeGenerator.ECCLevel.H);
         XamlQRCode      qrCode       = new XamlQRCode(qrCodeData);
         DrawingImage    qrCodeAsXaml = qrCode.GetGraphic(20);
         qrImage.Source = qrCodeAsXaml;
     }
     catch (Exception ex)
     {
         new Log().Escribir(ex);
     }
 }
        public QrCodeLoginDialog(GetLoginUrlData data)
        {
            _logger    = DI.GetRequiredService <ILogger <QrCodeLoginDialog> >();
            _apiClient = DI.GetRequiredService <BilibiliApiClient>();
            _data      = data;

            InitializeComponent();

            using var qrGenerator = new QRCodeGenerator();
            using var qrCodeData  = qrGenerator.CreateQrCode(data.url, QRCodeGenerator.ECCLevel.H, true);
            using var qrCode      = new XamlQRCode(qrCodeData);
            QrCodeImage.Source    = qrCode.GetGraphic(20);

            _loginInfoMonitor = CreateMonitor();

            PrimaryButtonCommand = ReactiveCommand.CreateFromTask(GetLoginInfoAsync);
        }
Пример #11
0
        /**
         * Renders the current hub code. This assumes that a hub token exists and doesn't check for null.
         */
        private void RenderCode()
        {
            Dispatcher.Invoke(() =>
            {
                QRCodeGenerator qrGenerator = new QRCodeGenerator();
                QRCodeData qrCodeData       = qrGenerator.CreateQrCode("https://remote.mimic.lol/" + Persistence.GetHubCode(), QRCodeGenerator.ECCLevel.Q);
                XamlQRCode qrCode           = new XamlQRCode(qrCodeData);

                ConnectionQR.Source     = qrCode.GetGraphic(20);
                ConnectionQR.Visibility = Visibility.Visible;

                CodeLabel.Content    = Persistence.GetHubCode();
                CodeLabel.Visibility = Visibility.Visible;

                ConnectionSteps.Visibility = Visibility.Visible;
                NoCodeText.Visibility      = Visibility.Hidden;
            });
        }
Пример #12
0
        /// <summary>
        /// Converts source values to a value for the binding target. The data binding engine calls this method when it propagates the values from source bindings to the binding target.
        /// </summary>
        /// <param name="values">The array of values that the source bindings in the <see cref="MultiBinding"/> produces. The value <see cref="System.Windows.DependencyProperty.UnsetValue"/> indicates that the source binding has no value to provide for conversion.</param>
        /// <param name="targetType">The type of the binding target property</param>
        /// <param name="parameter">The converter parameter to use</param>
        /// <param name="culture">The culture to use in the converter</param>
        /// <returns>
        /// A converted value.
        /// If the method returns <c>null</c>, the valid null value is used.
        /// A return value of <see cref="System.Windows.DependencyProperty.UnsetValue"/> indicates that the converter did not produce a value, and that the binding will use the <see cref="BindingBase.FallbackValue"/> if it is available, or else will use the default value.
        /// A return value of <see cref="Binding.DoNothing"/> indicates that the binding does not transfer the value or use the <see cref="BindingBase.FallbackValue"/> or the default value.
        /// </returns>
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                var secret   = values[0] as string;
                var user     = values[1] as UserInfo;
                var instance = values[2] as Instance;
                var otp_uri  = String.Format(user.ID != null ? "otpauth://totp/{1}:{2}?secret={0}&issuer={3}" : "otpauth://totp/{1}?secret={0}&issuer={3}",
                                             secret,
                                             instance.Base.Host,
                                             user.ID,
                                             HttpUtility.UrlEncode(instance.ToString()));

                var qr_generator = new QRCodeGenerator();
                var qr_code_data = qr_generator.CreateQrCode(otp_uri, QRCodeGenerator.ECCLevel.Q);
                var qr_code      = new XamlQRCode(qr_code_data);
                return(qr_code.GetGraphic(3, true));
            }
            catch { }

            // Fallback to blank image.
            return(new Uri("pack://application:,,,/eduVPN.Views;component/Resources/Blank.png"));
        }