×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Oct 2010
    Location
    Trivandrum ,Kerala
    Posts
    139

    How to close a Silverlight application programatically ?

    Is there any possibility to programatically close Silverlight application on Windows Phone 7?
    sreerajvr

  2. #2
    Registered User
    Join Date
    Aug 2011
    Posts
    7

    Re: How to close a Silverlight application programatically ?

    Practicaly no. You can throw exception that you do not handle in catch block, and app your will terminate, but that app will be rejected in later marketplace evaluation process.
    Anyway, you do not need to close your app. WP7 OS handles that. When user exit your app via back or start button, app stays in "dormant" mode, and when phone's free memory declines, OS starts with terminating dormant applications starting with oldest one. As a developer you just have to accept this kind of "housekeeping" paradigm.
    For better understanding of WP7 app execution process I suggest you to read "WP7 Execution model" chapter on MSDN: http://msdn.microsoft.com/en-us/libr...(v=VS.92).aspx
    And also note that there are some improvement regarding this topic in "Mango" WP7 release.

  3. #3
    Registered User
    Join Date
    Oct 2010
    Location
    Trivandrum ,Kerala
    Posts
    139

    Re: How to close a Silverlight application programatically ?

    Thank you so much.
    sreerajvr

  4. #4
    Regular Contributor
    Join Date
    Jan 2009
    Location
    India
    Posts
    138

    Re: How to close a Silverlight application programatically ?

    Hi sreerajvr,

    There is no such Managed API for closing your App. The proper way to close your app using *Back Key* allows you to close wp7 app.
    Pavan Pareta
    Sr. Software Engineer
    http://windows-mobile-dev.blogspot.com

  5. #5
    Registered User
    Join Date
    Oct 2011
    Posts
    1

    Re: How to close a Silverlight application programatically ?

    Hello,
    If you have a particular case where the "Back" navigation doesn't meet your needs like going back to page a view where the user should be authenticated and you should exit or have a home screen and want to avoid loops of some sort with the navigation:
    you can use the same method used in case you were developing a game:
    Add the xna librairie as a reference.
    and exit the application with this line of code:
    new Game().Exit();

  6. #6
    Registered User
    Join Date
    Oct 2011
    Posts
    7

    Re: How to close a Silverlight application programatically ?

    I didn't try yet , but maybe calling NavigationService.GoBack() on the mainpage after removing all the navigation history will close the running app.

    update:
    Just checked. It didn't work.
    Last edited by tarhini.hassan; 2011-10-31 at 03:36.

  7. #7
    Nokia Developer Champion
    Join Date
    Aug 2010
    Location
    Ahmedabad
    Posts
    299

    Re: How to close a Silverlight application programatically ?

    Quote Originally Posted by sreerajvr View Post
    Is there any possibility to programatically close Silverlight application on Windows Phone 7?
    Are you searching solution for XNA or Silverlight application? Because XNA has Game.Exit() I guess !

  8. #8
    Registered User
    Join Date
    Nov 2011
    Location
    Manaus, Brazil
    Posts
    5

    Re: How to close a Silverlight application programatically ?

    Althought using XNA's Game.Exit() is a possibility, I wouldn't recommend it.
    Actually, the Applications Guidelines (5.2.4) explains all requirements about the Back button, and all expected behaviors: http://msdn.microsoft.com/en-us/libr...(v=VS.92).aspx

    The thing is, you're not allowed to exit your aplication any way you want, period. But that's great to mantain a consistency of the OS.

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2011
    Location
    Portugal
    Posts
    948

    Re: How to close a Silverlight application programatically ?

    Quote Originally Posted by TBessa View Post
    Althought using XNA's Game.Exit() is a possibility, I wouldn't recommend it.
    Actually, the Applications Guidelines (5.2.4) explains all requirements about the Back button, and all expected behaviors: http://msdn.microsoft.com/en-us/libr...(v=VS.92).aspx

    The thing is, you're not allowed to exit your aplication any way you want, period. But that's great to mantain a consistency of the OS.
    I'm not sure thats 100% accurate. On kineticanimals for example you to have a exit game button. I've seen quite a few apps that does the same thing. All of them Games. Silverights apps does not have that option.

    Cheers

  10. #10
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,694

    Re: How to close a Silverlight application programatically ?

    Quote Originally Posted by joaocardoso View Post
    I'm not sure thats 100% accurate. On kineticanimals for example you to have a exit game button. I've seen quite a few apps that does the same thing. All of them Games. Silverights apps does not have that option.
    Where is the controversy?

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2011
    Location
    Portugal
    Posts
    948

    Re: How to close a Silverlight application programatically ?

    Quote Originally Posted by wizard_hu_ View Post
    Where is the controversy?
    Sorry you lost me there.

    There is no controversy. I was replying that while the back button is in fract the proper way to exit Silverlight apps, when it comes do XNA there are game that provide an exit button and that it works. The example I gave is a well known game app for windows phone that does that. There are more.

    cheers

  12. #12
    Registered User
    Join Date
    Nov 2011
    Location
    Manaus, Brazil
    Posts
    5

    Re: How to close a Silverlight application programatically ?

    Quote Originally Posted by joaocardoso View Post
    I'm not sure thats 100% accurate. On kineticanimals for example you to have a exit game button. I've seen quite a few apps that does the same thing. All of them Games. Silverights apps does not have that option.

    Cheers
    Actually that's what I maybe didn't explain correctly. What I meant to say is that you should only do that when you are producing XNA applications (like Games). There's no problem with that. Just don't do it in 100% Silverlight applications.

  13. #13
    Registered User
    Join Date
    Jan 2009
    Posts
    19

    Re: How to close a Silverlight application programatically ?


Similar Threads

  1. Install application programatically
    By efftronics in forum Mobile Java General
    Replies: 4
    Last Post: 2010-09-15, 11:05
  2. Close application Programatically
    By amit.mangal in forum Symbian
    Replies: 5
    Last Post: 2010-06-29, 14:35
  3. how to close application by close buttons in n900
    By babulamiet in forum Nokia N9
    Replies: 2
    Last Post: 2010-03-15, 09:08
  4. Replies: 35
    Last Post: 2010-02-26, 14:49
  5. uninstall application programatically
    By niraj_gandhi in forum Symbian
    Replies: 4
    Last Post: 2007-02-08, 05:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×