Пример #1
0
        private void btSubmit_Click(object sender, EventArgs e)
        {
            userconfig.ReceiptsDataSharing();

            string data = string.Empty;

            if (rbInput.Checked)
            {
                if (tbInput.Text == string.Empty)
                {
                    toolTip.Show("Empty field", tbInput, 3000); return;
                }
                data = tbInput.Text;
            }
            else
            {
                if (tbFile.Text == string.Empty)
                {
                    toolTip.Show("Empty field", tbFile, 3000); return;
                }
                switch (openFileDialog.FilterIndex)
                {
                case 1:
                    data = File.ReadAllText(tbFile.Text); break;

                case 2:
                    data = Ocr.GetText(tbFile.Text); break;

                default:
                    break;
                }
            }

            Receipt     receipt     = Receipt.Create(data);
            ReceiptForm receiptForm = new ReceiptForm(receipt);

            if (receipt.Items != null)
            {
                foreach (Item item in receipt.Items)
                {
                    DataManager.AddItem(item);
                    //DataManager.ClarificationSystem(item);
                }
            }

            DataManager.AddReceipt(receipt);
            receiptForm.Show();
        }
Пример #2
0
        private void Work()
        {
            while (true)
            {
                Thread.Sleep(100);
                List <Stream> streams  = capturador.GetImage();
                List <string> rawTexts = new List <string>();
                streams.ForEach(stream => rawTexts.Add(ocr.GetText(stream)));

                lock (chunks)
                {
                    for (int i = 0, c = rawTexts.Count; i < c; i++)
                    {
                        //System.IO.File.WriteAllText($"./rawText_{i}.txt", rawTexts[i]);
                        chunks.Add(rawTexts[i]);
                    }
                }
            }
        }