コード例 #1
0
ファイル: Form1.cs プロジェクト: yojan126/Learn
        private void DoTranslate()
        {
            UpdateProgress(10);
            Dictionary <string, string> dicWaitTrans = new Dictionary <string, string>();
            bool   bolFlag    = true;
            string strNewFile = "";

            do
            {
                dicWaitTrans = ee.GetExcelWords(ref bolFlag, dicAllWords);
                // Thread.Sleep(1000);
                UpdateProgress(30);
                if (com.GetMes(ref dicWaitTrans))
                {
                    foreach (string key in dicWaitTrans.Keys)
                    {
                        if (!dicAllWords.ContainsKey(key))
                        {
                            dicAllWords.Add(key, dicWaitTrans[key]);
                        }
                    }
                }
            } while (bolFlag);
            // Thread.Sleep(1000);
            UpdateProgress(70);

            if (dicAllWords != null && dicAllWords.Count > 0 && dicAllWords.Keys.ToArray()[0] != "ERROR")
            {
                ee.UpdateAndCreateExcel(dicAllWords, ref strNewFile);
                UpdateProgress(100);
                MessageBox.Show("保存路径:" + strNewFile, "翻译成功");
            }
        }