【问题标题】:Getting notified when user exits browser in Silverlight application当用户在 Silverlight 应用程序中退出浏览器时收到通知
【发布时间】:2017-01-05 01:33:58
【问题描述】:
【问题讨论】:
标签:
c#
silverlight
browser
【解决方案2】:
将 Silverlight 控件包装在 ASP.NET 页面中,您可以调用应用程序 Unload 事件覆盖。
protected override void OnUnload(EventArgs e)
{
base.OnUnload(e);
}
【解决方案3】:
以下代码帮助我解决了我的问题
public partial class App : Application
{
private MainPage mainPage;
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
}
private void Application_Exit(object sender, EventArgs e)
{
//Log out the current user when application exits
mainPage.LogoutCurrentUser();
}