Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Clean shutdown in WPF and SL using a Messenger
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  14 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Laurent Bugnion, GalaSoft  
View profile  
 More options Oct 18 2009, 3:56 pm
From: "Laurent Bugnion, GalaSoft" <laur...@galasoft.ch>
Date: Sun, 18 Oct 2009 21:56:53 +0200
Local: Sun, Oct 18 2009 3:56 pm
Subject: Clean shutdown in WPF and SL using a Messenger

Hey gang,

I just published a new article showing how to implement a clean shutdown
sequence in a Silverlight and WPF application. The sample app uses the MVVM
Light Toolkit Messenger, but of course this could also be implemented with
other kind of messengers.

I have been confronted to this kind of issues in production applications in
the past, with a lot of components having to shut down in a coordinated
manner, and I think that having a decoupled messenger makes that issue much,
much less difficult to tackle (and much, much easier to extend when new
components are added).

http://blog.galasoft.ch/archive/2009/10/18/clean-shutdown-in-silverli...
-wpf-applications.aspx

Hope you like it,

Laurent

--

Laurent Bugnion [Microsoft MVP, MCP]

Blog:  <http://www.galasoft.ch/> http://blog.galasoft.ch

Web:  <http://www.galasoft.ch/> http://www.galasoft.ch

Support children in Calcutta:  <http://www.calcutta-espoir.ch/>
http://www.calcutta-espoir.ch

cid:image001....@01C9C8AA.B722DA80

 <http://galasoft.ch/contact/mobile/> My

 <http://galasoft.ch/contact/mobile/> business

 <http://galasoft.ch/contact/mobile/> card

as

 <http://www.microsoft.com/tag> Microsoft Tag

  image001.png
7K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Anson  
View profile  
 More options Oct 19 2009, 3:38 am
From: David Anson <david...@microsoft.com>
Date: Mon, 19 Oct 2009 07:38:56 +0000
Local: Mon, Oct 19 2009 3:38 am
Subject: RE: [WPF Disciples] Clean shutdown in WPF and SL using a Messenger

Laurent,

I've only barely skimmed the article just now, but one of the biggest questions I've seen for Silverlight shutdown is how to do pretty much anything if the user decides to close by hitting the *browser's* close button. I've not tried this myself, but people seem to find some difficulty doing things like web service calls, etc. before their application gets terminated. Does your solution address this? If so, I think it would be worth calling specific attention to that in light of the interest I've seen already.

Thanks!

From: wpf-disciples@googlegroups.com [mailto:wpf-disciples@googlegroups.com] On Behalf Of Laurent Bugnion, GalaSoft
Sent: Sunday, October 18, 2009 12:57 PM
To: wpf-disciples@googlegroups.com
Subject: [WPF Disciples] Clean shutdown in WPF and SL using a Messenger

Hey gang,

I just published a new article showing how to implement a clean shutdown sequence in a Silverlight and WPF application. The sample app uses the MVVM Light Toolkit Messenger, but of course this could also be implemented with other kind of messengers.

I have been confronted to this kind of issues in production applications in the past, with a lot of components having to shut down in a coordinated manner, and I think that having a decoupled messenger makes that issue much, much less difficult to tackle (and much, much easier to extend when new components are added).

http://blog.galasoft.ch/archive/2009/10/18/clean-shutdown-in-silverli...

Hope you like it,
Laurent
--
Laurent Bugnion [Microsoft MVP, MCP]
Blog: http://blog.galasoft.ch<http://www.galasoft.ch/>
Web: http://www.galasoft.ch<http://www.galasoft.ch/>
Support children in Calcutta: http://www.calcutta-espoir.ch<http://www.calcutta-espoir.ch/>

[cid:image001....@01C9C8AA.B722DA80]

My<http://galasoft.ch/contact/mobile/>
business<http://galasoft.ch/contact/mobile/>
card<http://galasoft.ch/contact/mobile/>
as
Microsoft Tag<http://www.microsoft.com/tag>

  image001.png
7K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Corrado Cavalli  
View profile  
 More options Oct 19 2009, 3:52 am
From: Corrado Cavalli <corradocava...@gmail.com>
Date: Mon, 19 Oct 2009 02:52:35 -0500 (CDT)
Local: Mon, Oct 19 2009 3:52 am
Subject: Re: [WPF Disciples] Re: Clean shutdown in WPF and SL using a Messenger

AFAIK the only way to handle browser close or navigation to
another site is to use IApplicationService (Silverlight3)
unfortunately calls to webservices don't work.
Solution we've considered (but not tried) is to use JS/JQuery to
invoke it.

-Corrado

On Mon Oct 19 02:38:56 CDT 2009, David Anson


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Laurent Bugnion, GalaSoft  
View profile  
 More options Oct 19 2009, 3:53 am
From: "Laurent Bugnion, GalaSoft" <laur...@galasoft.ch>
Date: Mon, 19 Oct 2009 09:53:42 +0200
Local: Mon, Oct 19 2009 3:53 am
Subject: RE: [WPF Disciples] Re: Clean shutdown in WPF and SL using a Messenger

Hi David,

No, the solution proposed here concentrates on taking actions when a user
clicks on a button. For Silverlight to do something when the user closes the
browser is an old problem (and it is not specific to Silverlight, we had
this issue already in JavaScript back then). Unfortunately, even though
Silverlight has a "Application.Exit" event, as far as I know there is no
guarantee that operations executed there will be really performed,
especially not asynchronous operations (but it will be called when the
browser gets closed, so you can at least attempt to do something. Note that
Application.Exit cannot be cancelled.

Also, in the contrary to WPF, there is no equivalent Window.Closing (that
can be cancelled).

It's a good input, I will update the article to mention this. Thanks!!

Laurent

From: wpf-disciples@googlegroups.com [mailto:wpf-disciples@googlegroups.com]
On Behalf Of David Anson
Sent: Monday, October 19, 2009 9:39 AM
To: wpf-disciples@googlegroups.com
Subject: [WPF Disciples] Re: Clean shutdown in WPF and SL using a Messenger

Laurent,

I've only barely skimmed the article just now, but one of the biggest
questions I've seen for Silverlight shutdown is how to do pretty much
anything if the user decides to close by hitting the *browser's* close
button. I've not tried this myself, but people seem to find some difficulty
doing things like web service calls, etc. before their application gets
terminated. Does your solution address this? If so, I think it would be
worth calling specific attention to that in light of the interest I've seen
already.

Thanks!

From: wpf-disciples@googlegroups.com [mailto:wpf-disciples@googlegroups.com]
On Behalf Of Laurent Bugnion, GalaSoft
Sent: Sunday, October 18, 2009 12:57 PM
To: wpf-disciples@googlegroups.com
Subject: [WPF Disciples] Clean shutdown in WPF and SL using a Messenger

Hey gang,

I just published a new article showing how to implement a clean shutdown
sequence in a Silverlight and WPF application. The sample app uses the MVVM
Light Toolkit Messenger, but of course this could also be implemented with
other kind of messengers.

I have been confronted to this kind of issues in production applications in
the past, with a lot of components having to shut down in a coordinated
manner, and I think that having a decoupled messenger makes that issue much,
much less difficult to tackle (and much, much easier to extend when new
components are added).

http://blog.galasoft.ch/archive/2009/10/18/clean-shutdown-in-silverli...
-wpf-applications.aspx

Hope you like it,

Laurent

--

Laurent Bugnion [Microsoft MVP, MCP]

Blog:  <http://www.galasoft.ch/> http://blog.galasoft.ch

Web:  <http://www.galasoft.ch/> http://www.galasoft.ch

Support children in Calcutta:  <http://www.calcutta-espoir.ch/>
http://www.calcutta-espoir.ch

cid:image001....@01C9C8AA.B722DA80

 <http://galasoft.ch/contact/mobile/> My

 <http://galasoft.ch/contact/mobile/> business

 <http://galasoft.ch/contact/mobile/> card

as

 <http://www.microsoft.com/tag> Microsoft Tag

  image001.png
7K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Laurent Bugnion, GalaSoft  
View profile  
 More options Oct 19 2009, 4:25 am
From: "Laurent Bugnion, GalaSoft" <laur...@galasoft.ch>
Date: Mon, 19 Oct 2009 10:25:07 +0200
Local: Mon, Oct 19 2009 4:25 am
Subject: RE: [WPF Disciples] Re: Clean shutdown in WPF and SL using a Messenger
Hey Corrado,

Invoking JS when the browser is closing is very likely to fail. When I was
still very active in JavaScript (yes, this is one dark aspect of my past,
generally unknown ;) the specs of the browsers specified that nothing was
guaranteed to be executed if the browser was closing down, especially not
async operations such as web service calls.

If the intent is to log when a user is leaving a page or closing down, the
only viable way is to have a heartbeat ping the web server at regular
intervals, and log when the heart beat stops.

Cheers,
Laurent


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Vaughan  
View profile  
 More options Oct 19 2009, 6:13 pm
From: Daniel Vaughan <dbvaug...@gmail.com>
Date: Mon, 19 Oct 2009 15:13:09 -0700 (PDT)
Local: Mon, Oct 19 2009 6:13 pm
Subject: Re: Clean shutdown in WPF and SL using a Messenger
The conversation on this thread led me to do a little experimenting
this evening. So I thought I would share it with you guys. There are
two close interception points that I have examined. The first, and as
Laurent has said, unreliable interception point occurs after the
Silverlight App.Exit is raised; which I had a crack at using Ajax. And
the more reliable interception point uses the browsers onbeforeunload
event to assign a string to the event.returnValue, thereby giving time
to dispatch a web service call.

http://danielvaughan.orpius.com/post/Calling-Web-Services-from-Silver...

Cheers,
Daniel

On Oct 19, 10:25 am, "Laurent Bugnion, GalaSoft" <laur...@galasoft.ch>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremiah Morrill  
View profile  
 More options Oct 19 2009, 6:21 pm
From: Jeremiah Morrill <jeremiah.morr...@gmail.com>
Date: Mon, 19 Oct 2009 15:21:28 -0700
Local: Mon, Oct 19 2009 6:21 pm
Subject: Re: [WPF Disciples] Re: Clean shutdown in WPF and SL using a Messenger

Great article Daniel!  +5, insightful


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Vaughan  
View profile  
 More options Oct 19 2009, 6:30 pm
From: Daniel Vaughan <dbvaug...@gmail.com>
Date: Mon, 19 Oct 2009 15:30:22 -0700 (PDT)
Local: Mon, Oct 19 2009 6:30 pm
Subject: Re: Clean shutdown in WPF and SL using a Messenger
Thanks Jer!

On Oct 20, 12:21 am, Jeremiah Morrill <jeremiah.morr...@gmail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Anson  
View profile  
 More options Oct 19 2009, 7:07 pm
From: David Anson <david...@microsoft.com>
Date: Mon, 19 Oct 2009 23:07:52 +0000
Local: Mon, Oct 19 2009 7:07 pm
Subject: RE: [WPF Disciples] Re: Clean shutdown in WPF and SL using a Messenger
I've put this up on Twitter for whatever it's worth:
http://twitter.com/DavidAns/status/5003267725


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Vaughan  
View profile  
 More options Oct 19 2009, 7:18 pm
From: Daniel Vaughan <dbvaug...@gmail.com>
Date: Mon, 19 Oct 2009 16:18:44 -0700 (PDT)
Local: Mon, Oct 19 2009 7:18 pm
Subject: Re: Clean shutdown in WPF and SL using a Messenger
Thanks David.
It will be good to see if anyone has an alternative approach.

Cheers,
Daniel

On Oct 20, 1:07 am, David Anson <david...@microsoft.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Corrado Cavalli  
View profile  
 More options Oct 20 2009, 12:31 am
From: "Corrado Cavalli" <corradocava...@gmail.com>
Date: Tue, 20 Oct 2009 06:31:48 +0200
Local: Tues, Oct 20 2009 12:31 am
Subject: RE: [WPF Disciples] Re: Clean shutdown in WPF and SL using a Messenger
Superb article Daniel!
Does that work even when user navigates away from the application?
(wondering about 2nd approach...)

-Corrado


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Laurent Bugnion  
View profile  
 More options Oct 20 2009, 1:36 am
From: "Laurent Bugnion" <laur...@galasoft.ch>
Date: Tue, 20 Oct 2009 07:36:46 +0200
Local: Tues, Oct 20 2009 1:36 am
Subject: RE: [WPF Disciples] Re: Clean shutdown in WPF and SL using a Messenger
Disclaimer: i didn't write serious JavaScript code for quite some time so things might not be as i remember them anymore ;)

I didn't try, but i think it will be exactly the same. One of the difficulties of this exercise is that it is impossible to distinguish between the page being navigated away from, and the browser being shut down, because the events involved are exactly the same.

The article is great, and it would be very interesting to test on multiple browsers to see how they react. One caveat of using onbeforeunload in JavaScript is that IIRC it is not a standard event (or at least it was not when i used to write JavaScript code) so it might fail in some browsers (ah the joy of cross browser coding, i miss that... NOT)

Cheers,
Laurent
--
Sent from mobile

-original message-
Subject: [WPF Disciples] Re: Clean shutdown in WPF and SL using a Messenger
From: "Corrado Cavalli" <corradocava...@gmail.com>
Date: 20.10.2009 06:32

Superb article Daniel!
Does that work even when user navigates away from the application?
(wondering about 2nd approach...)

-Corrado


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Vaughan  
View profile  
 More options Oct 20 2009, 2:47 am
From: Daniel Vaughan <dbvaug...@gmail.com>
Date: Mon, 19 Oct 2009 23:47:33 -0700 (PDT)
Local: Tues, Oct 20 2009 2:47 am
Subject: Re: Clean shutdown in WPF and SL using a Messenger
Thank you kindly Corrado.

I've tested it with IE8 and FF3.5.3, and the second method worked
locally when the user navigates away using a bookmark, url in
navigation bar, and a hyperlink on the page.

Cheers,
Daniel

On Oct 20, 6:31 am, "Corrado Cavalli" <corradocava...@gmail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Vaughan  
View profile  
 More options Oct 20 2009, 2:50 am
From: Daniel Vaughan <dbvaug...@gmail.com>
Date: Mon, 19 Oct 2009 23:50:47 -0700 (PDT)
Local: Tues, Oct 20 2009 2:50 am
Subject: Re: Clean shutdown in WPF and SL using a Messenger
Thanks Laurent.
For sure cross browser support needs evaluating further.

On Oct 20, 7:36 am, "Laurent Bugnion" <laur...@galasoft.ch> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »