コード例 #1
0
ファイル: CheckInPrompt.cs プロジェクト: Sempredic/CheckInApp
        public void Initialize(QRCode code, SkuPrompt prompt)
        {
            this.Show();


            Bitmap bitmap = new Bitmap(code.GetGraphic(5));

            qrPictureBox.Image = bitmap;

            try
            {
                var          source       = new BitmapLuminanceSource(bitmap);
                var          binarizer    = new HybridBinarizer(source);
                var          binBitmap    = new BinaryBitmap(binarizer);
                QRCodeReader qrCodeReader = new QRCodeReader();

                Result str = qrCodeReader.decode(binBitmap);
                Console.WriteLine(str.Text);
            }
            catch { }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Sempredic/CheckInApp
        private DeviceObject RunDataGridView(DataGridViewRow v)
        {
            Bitmap       bitmap    = (Bitmap)v.Cells[5].Value;
            DeviceObject deviceObj = null;

            string device  = v.Cells[0].Value == null ? " " : v.Cells[0].Value.ToString();
            string serial  = v.Cells[1].Value == null ? " " : v.Cells[1].Value.ToString();
            string imei    = v.Cells[2].Value == null ? " " : v.Cells[2].Value.ToString();
            string mei     = v.Cells[3].Value == null ? " " : v.Cells[3].Value.ToString();
            string model   = v.Cells[4].Value == null ? " " : v.Cells[4].Value.ToString();
            string color   = v.Cells[5].Value == null ? " " : ColorTranslator.ToHtml(bitmap.GetPixel(0, 0));
            string carrier = v.Cells[6].Value == null ? " " : v.Cells[6].Value.ToString();

            List <string> fields = new List <string>()
            {
                device, serial, mei, imei, model, color, carrier
            };

            if (skuCheckBox.Checked)
            {
                SkuPrompt skuPrompt = new SkuPrompt();

                skuPrompt.Initialize(fields);

                if (skuPrompt.skuString != null)
                {
                    StreamWriter writer = new StreamWriter(dataLocation.Text, false);
                    deviceObj = new DeviceObject();

                    if (!File.Exists(dataLocation.Text))
                    {
                        File.Create(dataLocation.Text);
                    }

                    writer.WriteLine("DEVICE-SERIAL-IMEI-MEI-MODEL-COLOR-CARRIER");

                    writer.WriteLineAsync($"{skuPrompt.skuString}-{serial}-{imei}-{mei}-{model}-{color}-{skuPrompt.carrierString}");

                    writer.Close();

                    Task.Run(() => PrintProcess());

                    deviceObj.serialID = serial;
                    deviceObj.location = skuPrompt.locationString;
                    deviceObj.caseID   = skuPrompt.caseIDString;
                }
            }
            else
            {
                Console.WriteLine(device + " " + serial + " " + imei + " " + mei + " " + model + " " + color + " " + carrier);

                StreamWriter writer = new StreamWriter(dataLocation.Text, false);

                if (!File.Exists(dataLocation.Text))
                {
                    File.Create(dataLocation.Text);
                }

                writer.WriteLine("DEVICE-SERIAL-IMEI-MEI-MODEL-COLOR-CARRIER");

                if (carrier.Length > 1)
                {
                    if (modelCheckBox.Checked)
                    {
                        writer.WriteLineAsync(device + " (" + carrier + ") {" + model + "}-" + serial + "-" + imei + "-" + mei + "-" + model + "-" + color + "-" + carrier);
                    }
                    else
                    {
                        writer.WriteLineAsync(device + " (" + carrier + ")-" + serial + "-" + imei + "-" + mei + "-" + model + "-" + color + "-" + carrier);
                    }
                }
                else
                {
                    if (modelCheckBox.Checked)
                    {
                        writer.WriteLineAsync(device + " {" + model + "}-" + serial + "-" + imei + "-" + mei + "-" + model + "-" + color);
                    }
                    else
                    {
                        writer.WriteLineAsync(device + "-" + serial + "-" + imei + "-" + mei + "-" + model + "-" + color);
                    }
                }


                writer.Close();

                Task.Run(() => PrintProcess());
            }
            return(deviceObj);
        }