How to Shut-down a Silverlight Application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LoanB
    New Member
    • Nov 2007
    • 62

    How to Shut-down a Silverlight Application

    Hello team,

    I'm building a GIS Silverlight 4 application. I need to shut down the whole thing after a save event has taken place.

    So..
    1. User saves a new graphic to the SDE database,
    2. Messagebox shows success or fail..
    3. User clicks OK
    3. Application and browser shuts down..

    Has anyone got some code for me on how to do this please?

    Many Thanks,

    Loan
  • LoanB
    New Member
    • Nov 2007
    • 62

    #2
    Ok Found my own answer so here is is:

    1. Add a Javascript method :

    function ShutDownApplica tion()
    {
    window.open('', '_self', '');
    window.close();
    }

    2. in your Silverlight class:

    using System.Windows. Browser;

    // to call the above Javascript method use the following line:

    HtmlPage.Window .Invoke("ShutDo wnApplication") ;


    TIP: this will work as is in IE but Firefox blocks scripts from closing the browser. To overcome this do the following:

    1. In Firefox address bar type: about:config
    2. In the filter bar now type the following:

    dom.allow_scrip ts....

    now in the list change

    "dom.allow_scri pts_to_close_wi ndows" to TRUE

    Comment

    Working...