单独服务进行更改时的通知

Notification when changes was made by separate service

我有 wpf 应用程序和 Quartz.Net 调度程序,每 2 分钟 运行 一些作业。

此作业获取对象的响应集合。如果在我的 json-文件中这个对象不存在 - 作业将它们写入文件。

在 WPF 应用程序中,我只想显示文件中的集合。

所以我想知道 Job 何时修改文件。


目前我没有任何其他想法只能每 2 分钟检查一次文件并从中获取所有项目以显示。

如果WPF应用程序和文件在同一个操作系统下,可以使用FileSystemWatcher

否则,您可能希望通过远程连接从作业进程向 WPF 应用程序发送消息,以便 WPF 应用程序知道再次读取该文件。

您可以使用 WCF where the Job would act as a server that the WPF application connects to and waits to be notified or via raw sockets