예제 #1
0
 private void translateHanViet(string chineseContent, int batchId)
 {
     if (requestCancel)
     {
         return;
     }
     ThreadPool.QueueUserWorkItem(delegate(object param0) {
         if (requestCancel)
         {
             return;
         }
         hanVietResult[batchId] = Translator.ChineseToHanVietForBatch(chineseContent);
         processStatus[batchId]++;
     });
 }
예제 #2
0
        private void translateAndExportHanVietFormat(string[] chineseContents, string[] mergedFileNames)
        {
            bool   needToRemoveBlankLine = !insertBlankLinesCheckBox.Checked;
            string targetFolder          = targetFolderTextBox.Text;
            bool   outputToWord          = outputTypeComboBox.SelectedIndex == 6;

            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.ChineseToHanVietForBatch(chineseContents[num]), needToRemoveBlankLine, Path.Combine(targetFolder, mergedFileNames[num] + (outputToWord ? ".doc" : (mergedFileNames[num].EndsWith("txt") ? "" : ".txt"))), outputToWord);
                    processStatus[num]++;
                }, i);
            }
        }