. Net quick development practices Application iextenderprovider implements automatic input method Switching

Source: Internet
Author: User

I'm in front. the iextenderprovider extension component and. net quick development practice application iextenderprovider implements the binding between objects and UI controls two post articles introduce iextenderprovider's extended programming mode and the practices and examples of implementing objects and objects using iextenderprovider, next I will introduce a common function in the management information system development, the switching of input methods, a lot of online transaction processing system business volume is very busy, at a specific time, for example, in the registration and billing of his applications, there is a long queue of business managers in the window business, so there are strict requirements on the system's handling speed, on the software UI, in some cases, you need to enter Chinese characters in the Chinese Input Method state, but some must be completed in the non-Chinese Input Method State. For example, for a number type input, the full-angle number is entered in the Chinese state, in this case, we need to achieve the following results:

When Chinese characters are allowed, such as names, the Chinese Input Method is automatically enabled:

In the case of non-Chinese input, such as age, the Chinese Input Method status is automatically disabled:

So, how can we implement such requirements? There are many implementation methods. I only want to say that the iextenderprovider extension implementation method is in agileeas. NET platform integrates a small component named chineselanguageinput to complete this function. Next I will show you the implementation of chineselanguageinput:

[Toolboxitem ( True )] [Description ("Input control and automatic switch component ")] [Provideproperty (" Language ", Typeof (Component)] Public   Class Chineselanguageinput: component, iextenderprovider { Private Dictionary <control, inputlanguage> inputpolicagelist = New Dictionary <control, inputlanguage> (); Private Inputlanguage input = inputlanguage. currentinputlanguage; Public Chineselanguageinput (){} Public Chineselanguageinput (system. componentmodel. icontainer container) {container. Add ( This );} [Category (" Input Method ")] [Description (" GET/set the input method status of the control ")] Public Language getlanguage (control component ){ If (Inputemediagelist. Contains (Component )){ Return (Language) inputlanguagelist [component];} Return Language. Default ;} Public   Void Setlanguage (control component, Language C ){ If (Inputemediagelist. Contains (Component )! = True ) {Inputdomainagelist. Add (component, c); system. Windows. Forms. Control currentc = (system. Windows. Forms. Control) component; currentc. Enter + = New Eventhandler ( This . Currentc_enter );} Else {Inputemediagelist [component] = C ;}} Private   Void Currentc_enter ( Object Sender, eventargs e) {system. Windows. Forms. Control control = (system. Windows. Forms. Control) sender; If ( This . Getlanguage (Control) = language. Chinese) {inputlanguage. currentinputlanguage = This . Input ;} Else   If ( This . Getlanguage (Control) = language. English ){ If (! Object . Equals (inputlanguage. currentinputlanguage, inputlanguage. installedinputages [0]) { This . Input = inputlanguage. currentinputlanguage;} inputlanguage. currentinputlanguage = inputlanguage. installedinputlanguages [0] ;}# region iextenderprovider Member Bool Iextenderprovider. canextend ( Object Component ){ Return Component Is System. Windows. Forms. Control;} # endregion}

A language type is also used here:

/// <Summary>/// Input Method language./// </Summary>Public EnumLanguage {/// <Summary>/// It is the default value./// </Summary>Default = 0,/// <Summary>/// English input method status./// </Summary>English = 1,/// <Summary>/// Chinese Input Method status./// </Summary>Chinese = 2}

The above is all the source code of the chineselanguageinput component. How can I use it? In the same way, drag it on and design the input method status on the control:

Let's get it. I don't need a demo anymore. I 've posted all the component source code. Let's try it on your own.

QQ: 15118502

Link: agileeas. NET application development platform Introduction

Agile parallel development method of agileeas. net

Agile Software Engineering Lab

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.