简体   繁体   English

如何通知客户列表已被修改

[英]How to notify client that list has been modified

I need answer for following question, suppose the application is ASP.NET application or WPF application. 我需要以下问题的答案,假设应用程序是ASP.NET应用程序或WPF应用程序。

you have two screens live on two different machines one having an employee list and one having add employee screen what can be done when employee gets added the screen displaying the employee list gets a message that an employee has been added. 您在两台不同的计算机上同时拥有两个屏幕,一台具有员工列表,一台具有添加员工屏幕,当添加员工时可以执行的操作,显示员工列表的屏幕会显示一条消息,说明已添加了一个员工。

Please advise, 请指教,

ASP.NET server can't notify client about changes. ASP.NET服务器无法将更改通知给客户端。 You have to use some external library like SignalR (http://signalr.net/) to force client to remain in connection with server permanently and to make a possibility to notify clients about changes. 您必须使用诸如SignalR(http://signalr.net/)之类的外部库来迫使客户端永久保持与服务器的连接,并有可能将更改通知给客户端。

如果使用ObservableCollection ,则可以侦听CollectionChanged事件并检查参数是否已添加项目。

You can use WCF service to mediate between clients. 您可以使用WCF服务在客户端之间进行调解。 When employee gets added first client send information to service. 添加员工后,第一个客户将信息发送给服务。 Then WCF service send callback to second client. 然后,WCF服务将回调发送给第二个客户端。 See WCF callbacks 请参阅WCF回调

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM