Say I have 2 methods. One of them is a method called by changing the selected index in the list. The second method helps by clearing all text fields, setting the list index to -1 and setting the focus.
Question:
The second method is executed, during the code it changes the selected index of the list to -1, thereby setting an event trigger for the first method. Method 2 HALT executes its own execution and passes the process to the event, and then returns to its work after method 1 is finished ... OR has the whole method 2 not completed its entire code block, and then switched to method 1 after changing the selected index?
The first case.
, , .
, . , . , , . , , , . *
*
, , , . ( " " .) , , , . , , , .
, , "invoke index-changed event handler". , (, ), "set the index" .
, - , . , . ( !) , , , , , .
* , , . , .
, : ! , 2 . # Windows Forms .
: threading.
, .
, , . , , .NET, Il. ILDASM Reflector . IL , , , .
" ", . , , " ", .
, #, , . ( , , ), , ( ). () , .
: , , , . , , , GUI .
, :)
, , . Method2 , , , Method1 , Method2 .
, Method1, - : ( )
Method2(object sender, System.EventArgs e) { //Unsubscribe Method1 from ListboxEvent Listbox.OnSelectionChange -= Method1; ... Stuff Method2 actually does ... Manualy call Method1 if you want it to fire //Subscribe Method1 from ListboxEvent Listbox.OnSelectionChange += Method1; }
This is probably not optimal (and maybe some recommendations), but due to the lack of a better explanation, at least you have some information to help you perform the search. Hope this helps!
Source: https://habr.com/ru/post/1703539/More articles:Ruby Testing Rewriting Detection - ruby โโ| fooobar.comDuplicate keyword value in JSON - jsonUsing Linq-to-XML to embed using streaming - multithreadingUsing Linqdatasource and groupby - .net PropertiesHow do you get the main IP address of the host machine? - c #C # Raw Sockets Port Forwarding - c #How to configure SVN with files located in the directory structure / htdocs - version-controlA form message sends values โโthrough Request.QueryString instead of Request.Form - htmlWhen to Use EJB Transaction Attributes Required and Never - javaOne MSI for two different installations - visual-studioAll Articles