Print Page | Close Window

Silverlight Application Exit

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2796
Printed Date: 15-Oct-2026 at 3:35pm


Topic: Silverlight Application Exit
Posted By: rickadams
Subject: Silverlight Application Exit
Date Posted: 24-Jun-2011 at 10:00am
I would like to perform a Session Logout before my Silverlight OOB application exits. I need to handle both the Close Button event as well as the user closing the Application from the taskbar. The DevForce Async calls are not executed in Application_Exit. Because I am also persisting the Entity managers to Isolated Storage in Application_Exit the Session Logout update is actually performed the next time I startup the application and the EntityManager is restored from IS. is there any way I can do this Session Logout update before the Application actually exits.
 
Thanks
 
Rick Adams



Replies:
Posted By: robertg
Date Posted: 27-Jun-2011 at 10:17am
Rick,

From my research, it looks like this is a limitation with Silverlight, and thus is something that we can't handle in DevForce. It looks like it has to do with how calls are queued inside the UI thread. Have you tried putting your async code into a separate thread and locking your current thread until that has completed? I don't think that the application can exit until the UI thread is no longer locked. In your case, you may want to combine this with a MessageBox, telling the user that the application is exiting and that it may take a moment, rather than letting them think it's timed out.

Yours,
Robert


Posted By: smi-mark
Date Posted: 27-Jun-2011 at 3:06pm
Try doing it from the Application.MainWindow.Closing event, you can then execute your required code.


Posted By: robertg
Date Posted: 27-Jun-2011 at 3:13pm
I'll have to try that out. Thanks, Mark!



Print Page | Close Window