By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,880 Members | 660 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,880 IT Pros & Developers. It's quick & easy.

How to Shut-down a Silverlight Application

P: 62
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
Jun 8 '10 #1

✓ answered by LoanB

Ok Found my own answer so here is is:

1. Add a Javascript method :

function ShutDownApplication()
{
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("ShutDownApplication");


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_scripts....

now in the list change

"dom.allow_scripts_to_close_windows" to TRUE

Share this Question
Share on Google+
1 Reply

P: 62
Ok Found my own answer so here is is:

1. Add a Javascript method :

function ShutDownApplication()
{
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("ShutDownApplication");


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_scripts....

now in the list change

"dom.allow_scripts_to_close_windows" to TRUE
Jun 9 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.