2017-01-03 58 views
0

我有一個Silverlight應用程序,用戶可以在其中登錄。問題是有些用戶可能根本無法註銷。我想在我的應用程序中收到通知,以便我可以代表他註銷。我一直在瀏覽這裏,但沒有任何工作解決方案。最密切相關的文章,我發現這是: How to notify an user when he tries to close a tab or close the browser,但無法得到結果。當用戶在Silverlight應用程序中退出瀏覽器時收到通知

任何人都可以指出,當我的應用程序中用戶退出應用程序頁面或關閉瀏覽器時,我該如何通知?

+0

http://stackoverflow.com/questions/28109347/how-to-detect-if-user-close-browser-within-silverlight -app/28119621#28119621 – Mitchell

回答

0

裹在ASP.NET頁的Silverlight控件,你可以調用應用程序Unload事件覆蓋。

protected override void OnUnload(EventArgs e) 
{ 
    base.OnUnload(e); 
} 
0

下面的代碼幫我解決我的問題

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(); 
    } 
相關問題