Does VB.Net's lack of implicit interfaces make what I'm trying to do impossible?

冷暖自知 提交于 2019-11-29 17:01:07

I think, as with the subs you've already shown, you need to pass all of your calls down to the same calls in the base class. The trickiest are the event handlers, but DoWork can be implemented as:

Public Shadows Custom Event DoWork As DoWorkEventHandler Implements IBackgroundWorkerAdapter.DoWork
    AddHandler(Value As DoWorkEventHandler)
        AddHandler MyBase.DoWork, Value
    End AddHandler
    RemoveHandler(Value As DoWorkEventHandler)
        RemoveHandler MyBase.DoWork, Value
    End RemoveHandler
    RaiseEvent(sender As Object, e As DoWorkEventArgs)
        MyBase.OnDoWork(e)
    End RaiseEvent
End Event

And similarly for the other event handlers. In this way, event handlers added through your DoWork event are actually added to your base classes DoWork event.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!