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