Exemplo n.º 1
0
        private void InvokeTranslationReceived(TranslationReceivedEventArgs e)
        {
            EventHandler <TranslationReceivedEventArgs> received = TranslationReceived;

            if (received != null)
            {
                received(this, e);
            }
        }
Exemplo n.º 2
0
        private void translator_TranslationReceived(object sender, TranslationReceivedEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new EventHandler<TranslationReceivedEventArgs>(this.translator_TranslationReceived), new[] { sender, e });
            }
            else
            {
                try
                {
                    var resourceSet = this.context.CurrentLocalResourceSet;

                    foreach (var translationResult in e.Results)
                    {
                        // invoke 'after translation hook' to allow other plugins to tamper with the translation
                        this.webTranslatorPlugIn.InvokeAfterItemAutoTranslation(translationResult);

                        // TODO : HANDLE translationResult.Error
                        resourceSet.GetStringItem(translationResult.Key).Value = translationResult.Text;

                        if (this.markForReviewCheckBox.Checked)
                        {
                            resourceSet[translationResult.Key].ReviewPending = true;
                        }
                    }
                }
                catch (Exception exception)
                {
                    Tools.ShowExceptionMessageBox("Failed to use translation results", exception);
                }
            }
        }
Exemplo n.º 3
0
 private void InvokeTranslationReceived(TranslationReceivedEventArgs e)
 {
     EventHandler<TranslationReceivedEventArgs> received = TranslationReceived;
     if (received != null) received(this, e);
 }