我编写了一个库,它使用我们定制的嵌入式硬件处理所有 TCP/IP 通信。它与我们的大多数内部软件一起使用,将来可能会单独出售。
最烦人的是,每次我处理来自库的事件时,我都必须有一个单独的函数来调用。我只能想象有一种更简单的方法可以做到这一点,我只是不知道......
有任何想法吗?
public Setup(DiscoveryReader reader)
{
download = new DownloadFilesIndividual(Reader.ip, DateTime.Today);
download.OnDownloadStatus += new DownloadStatusHandler(download_OnDownloadStatus);
}
void download_OnDownloadStatus(DownloadStatus status)
{
Invoke(new DownloadStatusHandler(this.safe_download_OnDownloadStatus), new object[] { status });
}
void safe_download_OnDownloadStatus(DownloadStatus status)
{
// Do UI stuff here
}