AndrewUtil. dll (Version: 1.0.0.0) provides some function encapsulation that is often used in real projects.
In the first version, it contains mail sending, DBHelper, and N multiple practical functions ..
For the first release, I highly recommend the translation components in a AndrewUtil. dll Control to Boyou.
With this component, it is very simple to implement the translation function, just two lines of code (of course, here we write some judgments for the program to be more robust, better program experience)
Next, go to the code.
Complete code:
// Start asynchronous Translation
Private void btnTranslate_Click (object sender, EventArgs e)
{
// Set the type to be translated
If (cbow.agetype. SelectedIndex = 0)
Translate1.TranslateType = Translate. TranslateTypeEnum. EnglishToChinese;
Else
Translate1.TranslateType = Translate. TranslateTypeEnum. ChineseToEnglish;
Translate1.TranslateText = txtSourceLanguage. Text; // you can specify the Text to be translated.
Translate1.StartAsync (); // start asynchronous Translation
}
// Asynchronous translation completion event
Private void translate1_TranslateCompleteEvent (object sender, AndrewUtil. Controls. Translate. TranslateCompleteArgs e)
{
// When the translation is complete and there is no error, the translation content will be displayed on the Interface
If (e. Error = null)
TxtTargetLanguage. Text = e. TranslateResult;
Else
MessageBox. Show ("error! Error message: "+ e. Error );
}
The above is the complete asynchronous translation code.
Of course, this component also provides a synchronous method, but here we recommend the Asynchronous Method.
:
Free points: http://www.bkjia.com/uploadfile/2011/1215/20111215013516964.rar