Esempio n. 1
0
 private void lnkTidyTranslation_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     TextBox tbx = this.TabbedTexts[TranslPlace.Translated].TextBox;
     if (tbx == null)
         return;
     if (Regex.Replace(tbx.Text, @"\s", "").Length == 0)
     {
         MessageBox.Show("No text to verify!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     try
     {
         Utils.Tidy.Result[] result = Utils.Tidy.Result.Analyze(tbx.Text);
         if (result.Length == 0)
         {
             MessageBox.Show("The html is correct!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         frmEntryMessages.MessageDetail[] msgs = new frmEntryMessages.MessageDetail[result.Length];
         for (int i = 0; i < result.Length; i++)
             msgs[i] = new frmEntryMessages.MessageDetail(result[i]);
         this.SetEntryMessagesResults(tbx, msgs, true);
     }
     catch (Exception x)
     {
         MessageBox.Show(x.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Esempio n. 2
0
 private void lnkCheckTranslationSpelling_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     TextBox tbx = this.TabbedTexts[TranslPlace.Translated].TextBox;
     if (tbx == null)
         return;
     if (Regex.Replace(tbx.Text, @"\s", "").Length == 0)
     {
         MessageBox.Show("No text to verify!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     try
     {
         Utils.SpellChecker.Result[] errors;
         using (Utils.SpellChecker.Worker worker = Program.SpellChecker.GetWorker(this.CurrentPO.Language))
             errors = worker.Analyze(tbx.Text, true);
         if (errors.Length == 0)
         {
             MessageBox.Show("The text is correct!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         if (tbx.Enabled && (!tbx.ReadOnly))
         {
             using (Utils.SpellChecker.Worker worker = Program.SpellChecker.GetWorker(this.CurrentPO.Language, this.components))
             {
                 worker.Analyze(tbx);
             }
         }
         else
         {
             frmEntryMessages.MessageDetail[] msgs = new frmEntryMessages.MessageDetail[errors.Length];
             for (int i = 0; i < errors.Length; i++)
                 msgs[i] = new frmEntryMessages.MessageDetail(errors[i]);
             this.SetEntryMessagesResults(tbx, msgs, false);
         }
     }
     catch (Exception x)
     {
         MessageBox.Show(x.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }