Exemplo n.º 1
0
        private void bEditResults_Click(object sender, EventArgs e)
        {
            var f = new EditOcrResults(tbFinalOcrOutput.Text);
            var q = f.ShowDialog();

            if (q == DialogResult.OK)
            {
                tbFinalOcrOutput.Text = f.ReturnValue;
            }
        }
Exemplo n.º 2
0
        private void bContinueOcr_Click(object sender, EventArgs e)
        {
            Boolean isOK = false;
            Boolean finished = false;
            DialogResult Answer;
            string commodity;


            commodity = _textInfo.ToTitleCase(tbCommoditiesOcrOutput.Text.ToLower().Trim());
            if (commodity.ToUpper() == "Implausible Results!".ToUpper())
            {
                // check results
                var f = new EditOcrResults(tbFinalOcrOutput.Text);
                f.onlyImplausible = true;
                var q = f.ShowDialog();

                if (q == DialogResult.OK)
                {
                    tbFinalOcrOutput.Text = f.ReturnValue;
                }

                Acquisition(true);

                isOK = false;
            }
            else if (commodity.ToUpper() == "Imported!".ToUpper() || commodity.ToUpper() == "Finished!".ToUpper() || commodity.ToUpper() == "No rows found...".ToUpper())
            {
                // its the end
                isOK = true;
                finished = true;
            }
            else if (commodity.Length == 0 || KnownCommodityNames.Contains(commodity))
            {
                // ok, no typing error
                isOK = true;
            }
            else
            {
                // unknown commodity, is it a new one or a typing error ?
                Answer = MsgBox.Show(String.Format("Do you want to add '{0}' to the known commodities ?", commodity), "Unknown commodity !",
                                         MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

                if (Answer == System.Windows.Forms.DialogResult.OK)
                {
                    // yes, it's really new
                    addCommodity(commodity, RegulatedNoiseSettings.Language);
                    _Milkyway.addLocalized2RN(_commodities.Names);
                    isOK = true;
                }
            }

            if (isOK)
            {
                if (_commodityTexts == null || _correctionColumn >= _commodityTexts.GetLength(1) || finished)
                {
                    if (MsgBox.Show("Import this?", "Import?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        ImportFinalOcrOutput();
                        tbFinalOcrOutput.Text = "";
                        bContinueOcr.Enabled = false;
                        bIgnoreTrash.Enabled = false;
                        _commoditiesSoFar = new List<string>();
                        bClearOcrOutput.Enabled = false;
                        bEditResults.Enabled = false;

                        // save the new data immediately
                        SaveCommodityData(true);


                    }
                }
                else
                {
                    _commodityTexts[_correctionRow, _correctionColumn] = commodity.ToUpper();
                    _commoditiesSoFar.Add(_commodityTexts[_correctionRow, _correctionColumn].ToUpper());

                    ContinueDisplayingResults();
                }
            }

        }