private void SentenceTranslateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (dgvSubtitleSentence.SelectedCells.Count > 0)
     {
         var cell = dgvSubtitleSentence.SelectedCells[0];
         if (cell.ColumnIndex == 2)//只对字幕句子进行翻译
         {
             var sentence = cell.Value.ToString();
             cell.Value = sentence + "\r\n" + translateService.TranslateToChinese(sentence);
         }
     }
 }
Exemplo n.º 2
0
 private void SentenceTranslateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (dgvSubtitleSentence.SelectedCells.Count > 0)
     {
         var cell = dgvSubtitleSentence.SelectedCells[0];
         if (cell.ColumnIndex == 2)//只对字幕句子进行翻译
         {
             var sentence = cell.Value.ToString();
             try
             {
                 cell.Value = sentence + "\r\n" + translateService.TranslateToChinese(sentence);
             }
             catch (Exception ex)
             {
                 MessageBox.Show("整句翻译服务调用失败,请尝试其他服务");
             }
         }
     }
 }