예제 #1
0
        public void Verify(GridViewUserControl gv)
        {
            VerifierThread vt = new VerifierThread(gv, m_Verifier);
            Thread         t  = new Thread(new ThreadStart(vt.ThreadProc));

            t.Name         = "Zal verifier thread";
            t.IsBackground = true;
            //              m_WorkerThread.Priority = ThreadPriority.Lowest;
            t.SetApartmentState(ApartmentState.STA);
            t.Start();
            t.Join();
        }
예제 #2
0
        }   //  parseWordFormToolStripMenuItem_Click (...)

/*
 *      private void parseTextToolStripMenuItem_Click(object sender, EventArgs e)
 *      {
 *          // Choose the new file path
 *          string str_FilePath = "";
 *          OpenFileDialog fDialog = new OpenFileDialog();
 *          fDialog.Title = "Open Raw Text";
 *          fDialog.Filter = "Text files|*.txt|All files|*";
 *          fDialog.InitialDirectory = @"\";
 *          if (fDialog.ShowDialog() == DialogResult.OK)
 *          {
 *              str_FilePath = fDialog.FileName.ToString();
 *              int i_wf = m_TextAnalyzer.i_AnalyzeText(str_FilePath);
 *              if (i_wf >= 0)
 *              {
 *                  MessageBox.Show("The file has been parsed successfully, " + i_wf.ToString() + " wordforms processed.");
 *              }
 *              else
 *              {
 *                  MessageBox.Show("An error occurred during parsing");
 *              }
 *          }
 *          else
 *          {
 *              return;
 *          }
 *      }   //  parseTextToolStripMenuItem_Click (...)
 */

        private void batchTestToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!m_bDBOpen)
            {
                GetDbPath();
            }

            EM_ReturnCode eRet = m_Dictionary.eGetVerifier(ref m_Verifier);

            if (eRet != EM_ReturnCode.H_NO_ERROR)
            {
                MessageBox.Show("Unable to load Verifier.");
                return;
            }

            eRet = m_Verifier.eLoadStoredLexemes();
            if (eRet != EM_ReturnCode.H_NO_ERROR)
            {
                MessageBox.Show("Unable to load stored data.");
                return;
            }

            if (m_Verifier.iCount() <= 0)
            {
                MessageBox.Show("No test forms in the database", "Zal Test", MessageBoxButtons.OK);
                return;
            }

            TabPage             tabPageTestCases = new TabPage("Test");
            GridViewUserControl gv = new GridViewUserControl(m_sDbPath);

            gv.m_Parent = this;

            tabPageTestCases.Controls.Add(gv);

            string sLexemeHash = null;
            string sHeadword   = null;

            gv.Clear();

            eRet = m_Verifier.eGetFirstLexemeData(ref sLexemeHash, ref sHeadword);
            while (EM_ReturnCode.H_NO_ERROR == eRet)
            {
                gv.AddLexeme(sHeadword, sLexemeHash);
                eRet = m_Verifier.eGetNextLexemeData(ref sLexemeHash, ref sHeadword);
            }

            tabControl.Controls.Add(tabPageTestCases);
            tabControl.SelectTab(tabPageTestCases);
        }   //  batchTestToolStripMenuItem_Click (...)
예제 #3
0
 public VerifierThread(GridViewUserControl caller, CVerifierManaged verifier)
 {
     m_Caller = caller;
     m_Verifier = verifier;
 }
예제 #4
0
        /*
        private void parseTextToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Choose the new file path
            string str_FilePath = "";
            OpenFileDialog fDialog = new OpenFileDialog();
            fDialog.Title = "Open Raw Text";
            fDialog.Filter = "Text files|*.txt|All files|*";
            fDialog.InitialDirectory = @"\";
            if (fDialog.ShowDialog() == DialogResult.OK)
            {
                str_FilePath = fDialog.FileName.ToString();
                int i_wf = m_TextAnalyzer.i_AnalyzeText(str_FilePath);
                if (i_wf >= 0)
                {
                    MessageBox.Show("The file has been parsed successfully, " + i_wf.ToString() + " wordforms processed.");
                }
                else
                {
                    MessageBox.Show("An error occurred during parsing");
                }
            }
            else
            {
                return;
            }
        }   //  parseTextToolStripMenuItem_Click (...)
        */
        private void batchTestToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!m_bDBOpen)
            {
                GetDbPath();
            }

            EM_ReturnCode eRet = m_Dictionary.eGetVerifier(ref m_Verifier);
            if (eRet != EM_ReturnCode.H_NO_ERROR)
            {
                MessageBox.Show("Unable to load Verifier.");
                return;
            }

            eRet = m_Verifier.eLoadStoredLexemes();
            if (eRet != EM_ReturnCode.H_NO_ERROR)
            {
                MessageBox.Show("Unable to load stored data.");
                return;
            }

            if (m_Verifier.iCount() <= 0)
            {
                MessageBox.Show ("No test forms in the database", "Zal Test", MessageBoxButtons.OK);
                return;
            }

            TabPage tabPageTestCases = new TabPage ("Test");
            GridViewUserControl gv = new GridViewUserControl (m_sDbPath);
            gv.m_Parent = this;

            tabPageTestCases.Controls.Add(gv);

            string sLexemeHash = null;
            string sHeadword = null;

            gv.Clear();

            eRet = m_Verifier.eGetFirstLexemeData(ref sLexemeHash, ref sHeadword);
            while (EM_ReturnCode.H_NO_ERROR == eRet)
            {
                gv.AddLexeme(sHeadword, sLexemeHash);
                eRet = m_Verifier.eGetNextLexemeData(ref sLexemeHash, ref sHeadword);
            }

            tabControl.Controls.Add (tabPageTestCases);
            tabControl.SelectTab (tabPageTestCases);
        }
예제 #5
0
 public void Verify(GridViewUserControl gv)
 {
     VerifierThread vt = new VerifierThread(gv, m_Verifier);
     Thread t = new Thread (new ThreadStart (vt.ThreadProc));
     t.Name = "Zal verifier thread";
     t.IsBackground = true;
     //              m_WorkerThread.Priority = ThreadPriority.Lowest;
     t.SetApartmentState(ApartmentState.STA);
     t.Start();
     t.Join();
 }
예제 #6
0
 public VerifierThread(GridViewUserControl caller, CVerifierManaged verifier)
 {
     m_Caller   = caller;
     m_Verifier = verifier;
 }