所以假设这个功能:
Private Function appendText() As Boolean Handles weComs.WriteChat
if(Called by event)
'do something
else
'do something
Return Nothing
End Function
所以,就是这样,我想知道这个函数或方法是否有可能知道他是被事件调用还是被某个地方调用
答案 0 :(得分:0)
最好的方法是使用发件人。但如果不这样做,请将其作为参数传递。
Private Function appendText_Event() As Boolean Handles weComs.WriteChat
Return AppendText(True)
End Function
Private Function appendText() As Boolean
Return AppendText(False)
End Function
Private Function AppendText(CalledByEvent as Boolean) As Boolean
if(CalledByEvent)
'do something
else
'do something
Return Nothing
End Function