不活动时弹出 Silverlight 2.0
我有 silverlight 2.0 应用程序,它使用 WCF 服务来获取数据并验证服务等。是否有任何选项可以检查 silverlight 应用程序上的不活动状态,然后向用户显示一条弹出消息,说明没有活动正在进行,因此您将被注销并将页面重定向到登录页面?请指教。
此外,在每个页面上设置调度计时器并重置它的选项会很乏味,因为大约有 100 个 xaml 页面,因此我需要编辑每个 xaml 页面以检查活动,然后重置计时器。那么有没有其他更简单的方法。请建议!
提前致谢 赛伊
I have silverlight 2.0 application and which uses WCF service to get data and validate ser etc. Is there any option to check inactivity on silverlight app and then show a popup message to user saying that there is no activity going on so you will be logged out and redirect page to login page? Please advise.
Also the option of having dispatch timer and resetting it on every page would be tedious as there are around 100 xaml pages so I need to edit every xaml page in order to check the activity and then reset the timer. So is there is any other simpler approach. Please suggest!
Thanks in advance
Sai
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉这么晚才更新。最后我找到了解决方案。
在 Startup 方法的 App.xaml 中,我们可以将 MouseClick 或 mousemove 或其他任何内容附加到 RootVisual,因为所有页面都将链接到 RootVisual,创建一个变量来存储上次活动时间,以便事件(mousemove 或 click)更新App.xaml 中具有新值的lastActivityTime 变量。然后在App.xaml中添加dispatchtimer并定期检查当前时间减去lastActivityTime是否大于阈值时间,如果是则注销用户。
希望这有帮助。!!
sorry for updating this so late. Finally I was able to find a solution for this.
In the App.xaml in the Startup method, we can attached MouseClick or mousemove or whatever to the RootVisual, as all the pages will be linked to RootVisual, create a variable for storing last activity time so on the event(mousemove or click) update the lastActivityTime variable with new value in App.xaml. Then add dispatchtimer in App.xaml and check at regualr intervals of time if the current time minus lastActivityTime is greater than threshold time if so logout the user.
Hope this helps.!!