测试类:
测试代码:
图示如前文所示,输出日志为:
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
Imports LzmTW.ApplicationBase
Imports LzmTW.uRemoting.MethodWatcher
<MethodLog()> <MethodLogAppend("Add")> <MethodLogAppend("LinkDatabase")> _
<MessageForm()> _
<MessageFormAppend("Add", _
Message:="正处理Add若你原耐心等多一天,定会令历史因些改", title:="请稍候,就五分钟也等不来吗", _
Formtype:=MessageFormType.Progress)> _
<MessageFormAppend("LinkDatabase", _
Message:="正尝试连接数据库 ." & vbCrLf & "你不用说我也知道,可我也骗我自己,说你没骗我", title:="稍等,骗人的,数据库在哪?", _
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("正在处理第{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
Imports LzmTW.uRemoting.MethodWatcher
<MethodLog()> <MethodLogAppend("Add")> <MethodLogAppend("LinkDatabase")> _
<MessageForm()> _
<MessageFormAppend("Add", _
Message:="正处理Add若你原耐心等多一天,定会令历史因些改", title:="请稍候,就五分钟也等不来吗", _
Formtype:=MessageFormType.Progress)> _
<MessageFormAppend("LinkDatabase", _
Message:="正尝试连接数据库 ." & vbCrLf & "你不用说我也知道,可我也骗我自己,说你没骗我", title:="稍等,骗人的,数据库在哪?", _
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("正在处理第{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
测试代码:
Public Class Form1
Dim t As New MethodWatcherTestClass
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
t.Add(100, 1)
t.LinkDatabase("it", "is")
End Sub
Dim MethodLogCenter As New LzmTW.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 Sub testThread()
t.Add(1, 1)
t.LinkDatabase("it", "is")
End Sub
End Class
Dim t As New MethodWatcherTestClass
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
t.Add(100, 1)
t.LinkDatabase("it", "is")
End Sub
Dim MethodLogCenter As New LzmTW.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 Sub testThread()
t.Add(1, 1)
t.LinkDatabase("it", "is")
End Sub
End Class
图示如前文所示,输出日志为:
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