示例#1
0
        private void translateAndExportVietPhraseFormat(string[] chineseContents, string[] mergedFileNames)
        {
            int    wrapType = (vietPhraseTranslationTypeComboBox.SelectedIndex == 2) ? 11 : vietPhraseTranslationTypeComboBox.SelectedIndex;
            bool   needToRemoveBlankLine = !insertBlankLinesCheckBox.Checked;
            string targetFolder          = targetFolderTextBox.Text;
            bool   outputToWord          = outputTypeComboBox.SelectedIndex == 2;
            int    translationAlgorithm  = translationAlgorithmComboBox.SelectedIndex;
            bool   prioritizedName       = prioritizedNameCheckBox.Checked;

            for (int i = 0; i < chineseContents.Length; i++)
            {
                if (requestCancel)
                {
                    return;
                }
                ThreadPool.QueueUserWorkItem(delegate(object batchIndexObject) {
                    if (requestCancel)
                    {
                        return;
                    }
                    int num = (int)batchIndexObject;
                    VietPhraseExporter.Export(Translator.ChineseToVietPhraseForBatch(chineseContents[num], wrapType, translationAlgorithm, prioritizedName), needToRemoveBlankLine, Path.Combine(targetFolder, mergedFileNames[num] + (outputToWord ? ".doc" : (mergedFileNames[num].EndsWith("txt") ? "" : ".txt"))), outputToWord);
                    processStatus[num]++;
                }, i);
            }
        }
示例#2
0
 private void translateVietPhrase(string chineseContent, int wrapType, int translationAlgorithm, bool prioritizedName, int batchId)
 {
     if (requestCancel)
     {
         return;
     }
     ThreadPool.QueueUserWorkItem(delegate(object param0) {
         if (requestCancel)
         {
             return;
         }
         vietPhraseResult[batchId] = Translator.ChineseToVietPhraseForBatch(chineseContent, wrapType, translationAlgorithm, prioritizedName);
         processStatus[batchId]++;
     });
 }