SilverlightShow: Tip: How to handle Silverlight application exit? Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples SilverlightShow.net http://www.rssboard.org/rss-specification Argotic Syndication Framework 2008.0.2.0, http://www.codeplex.com/Argotic en-US estoychev@completit.com (Emil Stoychev) RE: Tip: How to handle Silverlight application exit? <p>Hi,</p> <p>Thanks, I got the line I was missing...</p> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">HtmlPage</span> <span style="font-family: consolas; font-size: 13px;">.RegisterScriptableObject(</span><span style="font-family: consolas; color: #a31515; font-size: 13px;">"myApp"</span><span style="font-family: consolas; font-size: 13px;">, mainPage);</span></p> http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx#comment4381 Varsha http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx Wed, 01 Sep 2010 07:37:25 GMT RE: Tip: How to handle Silverlight application exit? <p>Hi,</p> <p>Thanks for your response,I am able to do that now in the sample application provided by you,but in actual application when i try to run it gives some javascript error while calling below line.I tried same in the sample application given by you it works fine.</p> <span style="font-family: consolas; color: #0000ff; font-size: 13px;">var</span> <span style="font-family: consolas; font-size: 13px;">out = slApp.Content.myApp.AskToSaveChanges();</span> <p><span style="font-family: consolas; font-size: 13px;">Is ther anything else that I need to do except making <span style="font-family: consolas; font-size: 13px;">AskToSaveChanges</span> <span style="font-family: consolas; font-size: 13px;">[</span><span style="font-family: consolas; color: #2b91af; font-size: 13px;">ScriptableMember</span><span style="font-family: consolas; font-size: 13px;">] in order to acess it from javascript.</span></span> </p> http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx#comment4380 Varsha http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx Wed, 01 Sep 2010 07:13:23 GMT RE: Tip: How to handle Silverlight application exit? I would recommend you look for that on some JavaScript forum. I don't have an idea how you can prevent browser close, but at least you can still save your data before closing the browser. http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx#comment4375 emil http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx Tue, 31 Aug 2010 17:48:14 GMT RE: Tip: How to handle Silverlight application exit? Thanks...But the window is closed on click of OK I wud like window to be open on clikck of OK and click of cancel window to be closed. http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx#comment4373 Varsha http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx Tue, 31 Aug 2010 14:47:47 GMT RE: Tip: How to handle Silverlight application exit? <p>Hi,</p> <p>I would recommend you to define a scriptable method in your SL app and call it from onbeforeunload event. Here is a sample solution: <a href="http://www.silverlightshow.net/Storage/HandleWindowClose.zip">Download</a></p> <p>Regards,</p> <p>Emil</p> http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx#comment4367 emil http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx Tue, 31 Aug 2010 10:21:44 GMT RE: Tip: How to handle Silverlight application exit? <p>Hi,</p> <p>I want to prompt the user  if User has unsaved data on page and would like to close the window or not.Which event I shoul I use.</p> http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx#comment4366 Varsha http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx Tue, 31 Aug 2010 09:46:02 GMT RE: Tip: How to handle Silverlight application exit? <p>Hi <span id="ctl00_cphMiddle_ContentPlaceHolderContent_itemComments_dlstComments_ctl04_lblCommentAuthor">fanshengrui,</span></p> <p><span>What is the reason you cannot work with the ExitEvent handler? Do you get an error?</span></p> http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx#comment3012 iiordanov http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx Thu, 28 Jan 2010 14:33:03 GMT RE: Tip: How to handle Silverlight application exit? <p>Can you help me?</p> <p>I Can't Work With the Exit Event Handler? I'm Waiting the Answer......</p> http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx#comment3011 fanshengrui http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx Thu, 28 Jan 2010 14:06:36 GMT RE: Tip: How to handle Silverlight application exit? If you're using Visual Studio as your project creation point you want to open the App.xaml.cs file that is automatically created for you and add your code into the Application_Exit(object sender, EventArgs e) method that is created for you.<br /> http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx#comment2211 Darryl http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx Thu, 06 Aug 2009 12:35:06 GMT RE: Tip: How to handle Silverlight application exit? Have you actually tried to run code within the event handler?  It doesn't work... http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx#comment1925 John http://www.silverlightshow.net/items/How-to-handle-Silverlight-application-exit.aspx Mon, 13 Jul 2009 17:35:51 GMT