C # AndrewUtil. dll released & amp; share (translation component) in a small blog)

Source: Internet
Author: User

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
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.