Heterogeneous how to: prompt the prompt box (7)

Source: Internet
Author: User
Test class: Imports Lzmtw. applicationbase
Imports Lzmtw. uremoting. methodwatcher

< Methodlog () >   < Methodlogappend ( " Add " ) >   < Methodlogappend ( " Linkdatabase " ) > _
< Messageform () > _
< Messageformappend ( " Add " ,_
Message: = " Processing Add. If you wait patiently for one day, it will make some changes to history. " , Title: = " Please wait. Won't you wait for five minutes? " ,_
Formtype: = Messageformtype. Progress) > _
< Messageformappend ( " Linkdatabase " ,_
Message: = " Trying to connect to the database. "   & Vbcrlf &   " You don't have to say that I know, but I also lie to myself, saying that you didn't lie to me " , Title: = " Wait, it's a lie. Where is the database? " ,_
Formtype: = Messageformtype. Progress) > _
Public   Class Methodwatchertestclass
Inherits Contextboundobject

Public   Function Add ( Byval X As   Integer , Byval Y As   Integer ) As   Integer
' Lzmtw. applicationbase. waitingform. defaultform. Show ()
For I As   Integer   =   0   To   2000
' Lzmtw. applicationbase. waitingform. defaultform. receivemessage ("processing item {0}", new object () {I })
Threading. thread. Sleep ( 1 )
Next
' Lzmtw. applicationbase. waitingform. defaultform. Close ()
Return X + Y
End Function

Public   Sub Linkdatabase ( Byval T As   String , Byval B As   String )
For I As   Integer   =   0   To   2000
' Console. writeline (I)
Threading. thread. Sleep ( 1 )
Next
End sub

End Class

TestCode:Public ClassForm1

Dim T As   New Methodwatchertestclass
Private   Sub Button#click ( Byval Sender As System. object, Byval E As System. eventargs) Handles Button1.click
T. Add ( 100 , 1 )
T. linkdatabase ( " It " , " Is " )
End sub

DimMethodlogcenterAs NewLzmtw. uremoting. methodwatcher. methodlogcenter

private sub button2_click ( byval sender as system. object, byval E as system. eventargs) handles button2.click
methodlogcenter. ready ()
end sub

private sub button3_click ( byval sender as system. object, byval E as system. eventargs) handles button3.click
methodlogcenter. remove ()
end sub

Private SubTestthread ()
T. Add (1,1)
T. linkdatabase ("It","Is")
End sub
End Class

As shown in the preceding figure, the output log is:

waitingdemo. methodwatchertestclass + Add (100,1)
methodotherbeing: waitingdemo. methodwatchertestclass + Add: messageformappendattribute
methodotherover: waitingdemo. methodwatchertestclass + Add: messageformappendattribute
waitingdemo. methodwatchertestclass + Add result is 101
waitingdemo. methodwatchertestclass + linkdatabase (it, is)
methodotherbeing: waitingdemo. methodwatchertestclass + linkdatabase: messageformappendattribute
methodotherover: waitingdemo. methodwatchertestclass + linkdatabase: messageformappendattribute
waitingdemo. methodwatchertestclass + linkdatabase result is system. void

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.