Example #1
0
        private void TestMonoColor(string value, string fileName, Color color1, Color color2)
        {
            string filePath = TestUtils.GetFilePath(fileName);

            var bitmapWrite = ColorZXingMono.Encode(value, 400, 400, 0, color1, color2);

            ColorZXing.Utils.WriteBitMap(bitmapWrite, filePath, ImageFormat.Png);

            var bitmapRead = Utils.ReadBitMap(filePath);
            var txtDecoded = ColorZXingMono.Decode(bitmapRead);

            Assert.AreEqual(value, txtDecoded);
        }
Example #2
0
        public async Task<Student> SaveStudent(Student student)
        {
            /*var writer = new BarcodeWriter()
            {
                Format = BarcodeFormat.QR_CODE,
                Options = new ZXing.Common.EncodingOptions()
                {
                    Height = 300,
                    Width = 300,
                    Margin = 1,
                },
            };

            var text = JsonConvert.SerializeObject(student);
            var bitmap = writer.Write(text);*/

            var text = JsonConvert.SerializeObject(student);
            var bitmap = ColorZXingMono.Encode(text, 300, 300, 1, Color.LightBlue);

            bitmap.Save(@"C:\Users\gramirez\Documents\dojo\qrtest.png", ImageFormat.Png);

            var base64String = string.Empty;

            using (var ms = new MemoryStream())
            {
                using (var bmp = new Bitmap(bitmap))
                {
                    bmp.Save(ms, ImageFormat.Png);
                    base64String = Convert.ToBase64String(ms.GetBuffer());
                }
            }

            var pagosBan = new PagosBanorte();  
            var pagosInb = new PagosInbursa();

            var totalBan = pagosBan.GetTotal(5, 5);
            var totalInb = pagosInb.GetTotal(10, 10);

            await studentDb.Students.AddAsync(student);

            await studentDb.Save();
            return student;
        }