Home > Net >  ComboBox TextChange caton reason asynchronous events, multithreading
ComboBox TextChange caton reason asynchronous events, multithreading

Time:09-15

Don't post the source code, simple say my UI interface
On the left side of a ComBoBox interface, a TextChange events;
On the right side of a skinPanel1 container, with the following code to load the third party program
 
Private void LoadThirdProess (string ThirdProessFilePath)
{
SkinPanel1. Controls. The Clear ();

The Process of p=new Process ();
P. tartInfo. FileName=ThirdProessFilePath;
P. tartInfo. WindowStyle=ProcessWindowStyle. Minimized;//plus the better
P. tart ();
System. Threading. Thread. Sleep (1000);//plus 100 effect if not will continue to increase
MaiPtr=p. ainWindowHandle;
SetParent (p. ainWindowHandle, skinPanel1. Handle);//panel1. Handle to show the external program container
MoveWindow (p. ainWindowHandle, 0, 0, skinPanel1. Width, skinPanel1. Height, true);
}


Now say the problem:
When after loading LoadThirdProess form load, run TextChange events in the process of slowly, slowly to enter Text in the process of caton;
But if we don't run LoadThirdProess, everything is normal,

Try to plan:
Form the load load, change to this
 Task. Run (()=& gt; {LoadAutoMesureWateP (); });//load the third-party applications 

Results the
 SetParent (p. ainWindowHandle, skinPanel1. Handle).//panel1. Handle to show the external program container 
the test pass,

I for multithreaded and asynchronous don't understand, please tall person to give directions,

And I want to ask the reason, I don't have closely studied asynchronous and multi-threaded because:
I feel this kind of condition and asynchronous it doesn't matter ah, because even if LoadThirdProess this code to time-consuming and resources, and only when the whole form the load works again; ComboBox TextChangeg event is in the form the load is completed for a long time didn't call, not a point in time, should not affect to ah,

I guess TextChangeg reason is because of the lack of system memory (or CPU), which is the third party programs (ThirdProessFilePath this path program) the system resource usage, like early low with a computer, but also should not ah, because my third party programs only dozens of M, could not have so many resources,

Don't understand, such as down,


CodePudding user response:

Run a tripartite application elapsed time how can know? If a third party takes too much time to test
  •  Tags:  
  • C#
  • Related