![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Thread.Sleep locks my movies. Why? Hi To fake a slow connection, I do Thread.Sleep(random_delay); However when I do that, it stops the movies on the screen (actually a single movie). It also stops my story boards. That Thread.Sleep is a delegate function called through the following Application app = Application.Current; app.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, new GetProductList(this.PopulateProductListHandler)); Anyways, I can fix this behavior? Thanks Phil |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Thread.Sleep locks my movies. Why? Animations & storyboards, along with input processing, layout, data binding, and a few other things, happen on the UI thread, so if the UI thread is sleeping, those things won't get done. https://blogs.msdn.com/nickkramer/ar...17/553378.aspx has more details on WPF threading. Why it's pausing the video is well is a little more of a mystery to me -- once the movie is started, the rendering happens on a different thread (the render thread). All I can figure is maybe at some point, the movie needs to synchronize the clock with the storyboard, and at that point gets stuck waiting for the UI thread. -Nick Kramer [MSFT] --- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm "Philippe Lavoie" <philippe.lavoie@cactus.ca> wrote in message news:uTDZw$QVGHA.6084@TK2MSFTNGP14.phx.gbl... > Hi > > To fake a slow connection, I do Thread.Sleep(random_delay); > However when I do that, it stops the movies on the screen (actually a > single movie). It also stops my story boards. > > That Thread.Sleep is a delegate function called through the following > > Application app = Application.Current; > > app.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, > new GetProductList(this.PopulateProductListHandler)); > > Anyways, I can fix this behavior? > > Thanks > > Phil |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Thread.Sleep locks my movies. Why? My issue is to get background processing done that will eventually update some of the databinds, i.e. the UI thread (I guess). Scenario: I do a request to a web service to fetch some products. I don't want to block the UI, but the UI needs to be aware that the data representing the products has been updated. My approach seem to work except if I do a sleep. Perhaps I'll just add a sleep on the web service itself to do my tests ![]() Thanks Phil PS I'll start reading your whitepaper ASAP. Nick Kramer [MSFT] wrote: > Animations & storyboards, along with input processing, layout, data binding, > and a few other things, happen on the UI thread, so if the UI thread is > sleeping, those things won't get done. > https://blogs.msdn.com/nickkramer/ar...17/553378.aspx has more > details on WPF threading. > > Why it's pausing the video is well is a little more of a mystery to me -- > once the movie is started, the rendering happens on a different thread (the > render thread). All I can figure is maybe at some point, the movie needs to > synchronize the clock with the storyboard, and at that point gets stuck > waiting for the UI thread. > > -Nick Kramer [MSFT] > > --- > This posting is provided "AS IS" with no warranties, and confers no rights. > Use of included script samples are subject to the terms specified at > http://www.microsoft.com/info/cpyright.htm > > "Philippe Lavoie" <philippe.lavoie@cactus.ca> wrote in message > news:uTDZw$QVGHA.6084@TK2MSFTNGP14.phx.gbl... > >>Hi >> >>To fake a slow connection, I do Thread.Sleep(random_delay); >>However when I do that, it stops the movies on the screen (actually a >>single movie). It also stops my story boards. >> >>That Thread.Sleep is a delegate function called through the following >> >>Application app = Application.Current; >> >>app.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, >> new GetProductList(this.PopulateProductListHandler)); >> >>Anyways, I can fix this behavior? >> >>Thanks >> >>Phil > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Thread.Sleep locks my movies. Why? Yeah, a server-side pause would do a really good job of simulating what would actually happen in the case of network lag. -- -Nick Kramer [MSFT] --- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm "Philippe Lavoie" <philippe.lavoie@cactus.ca> wrote in message news:O634UKCWGHA.1192@TK2MSFTNGP04.phx.gbl... > My issue is to get background processing done that will eventually update > some of the databinds, i.e. the UI thread (I guess). > > Scenario: I do a request to a web service to fetch some products. I don't > want to block the UI, but the UI needs to be aware that the data > representing the products has been updated. > > My approach seem to work except if I do a sleep. Perhaps I'll just add a > sleep on the web service itself to do my tests ![]() > > Thanks > > Phil > > PS I'll start reading your whitepaper ASAP. > > Nick Kramer [MSFT] wrote: >> Animations & storyboards, along with input processing, layout, data >> binding, and a few other things, happen on the UI thread, so if the UI >> thread is sleeping, those things won't get done. >> https://blogs.msdn.com/nickkramer/ar...17/553378.aspx has more >> details on WPF threading. >> >> Why it's pausing the video is well is a little more of a mystery to me -- >> once the movie is started, the rendering happens on a different thread >> (the render thread). All I can figure is maybe at some point, the movie >> needs to synchronize the clock with the storyboard, and at that point >> gets stuck waiting for the UI thread. >> >> -Nick Kramer [MSFT] >> >> --- >> This posting is provided "AS IS" with no warranties, and confers no >> rights. >> Use of included script samples are subject to the terms specified at >> http://www.microsoft.com/info/cpyright.htm >> >> "Philippe Lavoie" <philippe.lavoie@cactus.ca> wrote in message >> news:uTDZw$QVGHA.6084@TK2MSFTNGP14.phx.gbl... >> >>>Hi >>> >>>To fake a slow connection, I do Thread.Sleep(random_delay); >>>However when I do that, it stops the movies on the screen (actually a >>>single movie). It also stops my story boards. >>> >>>That Thread.Sleep is a delegate function called through the following >>> >>>Application app = Application.Current; >>> >>>app.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, >>> new GetProductList(this.PopulateProductListHandler)); >>> >>>Anyways, I can fix this behavior? >>> >>>Thanks >>> >>>Phil >> >> |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Computer just locks when I put it to sleep | General Discussion | |||
| How do the current thread get thread notification of OS intruption | .NET General | |||
| Start a new thread from an existing thread, which was started from atimer | .NET General | |||
| System locks up in sleep mode on Vista | Vista performance & maintenance | |||
| Another movies thread n | General Discussion | |||