using ETC2019.Models.Barcode.Linear;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ETC2019.Views
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            StreamReader sr = new StreamReader(Path.Combine("data", "code39.json"));

            Code39 decode = JsonConvert.DeserializeObject<Code39>(sr.ReadToEnd());

            Bitmap image = new Bitmap(@"C:\Users\ECOM\Downloads\新增資料夾\SKMBT_C36019071710411.jpg");

            pictureBox1.Image = image.Clone(new Rectangle(288, 641, 376, 113), image.PixelFormat);

            textBox1.Text = decode.Decode(image.Clone(new Rectangle(288, 641, 376, 113), image.PixelFormat));

            pictureBox2.Image = image.Clone(new Rectangle(1438, 872, 114, 114), image.PixelFormat);

            textBox2.Text = decode.Decode(image.Clone(new Rectangle(1438, 872, 114, 114), image.PixelFormat));

            sr.Close();
        }
    }
}
