Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

statusbar textblock update in long running operation

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 07-23-2007   #1 (permalink)
Scott Walters
Guest


 

statusbar textblock update in long running operation

I have a status bar on my window that contains a TextBlock. I am trying
to update the text in the textblock during a long operation that's
running inside a button click handler on the same window. The text
doesn't update until the end, which is not what I want. I've tried
several combinations of InvalidateArrange(), InvalidateVisual() and
UpdateLayout() on both the TextBlock and it's parent StatusBar without
success. How can I do this?

Thanks,
Scott

My System SpecsSystem Spec
Old 07-23-2007   #2 (permalink)
Radek Cerny
Guest


 

Re: statusbar textblock update in long running operation

It needs to be on a different thread - best way is probably to spawn a new
thread on button click. Plenty of examples around.

"Scott Walters" <scottw512@hotmail.com> wrote in message
news:O1CkIyUzHHA.3400@TK2MSFTNGP03.phx.gbl...
>I have a status bar on my window that contains a TextBlock. I am trying to
>update the text in the textblock during a long operation that's running
>inside a button click handler on the same window. The text doesn't update
>until the end, which is not what I want. I've tried several combinations of
>InvalidateArrange(), InvalidateVisual() and UpdateLayout() on both the
>TextBlock and it's parent StatusBar without success. How can I do this?
>
> Thanks,
> Scott



My System SpecsSystem Spec
Old 07-26-2007   #3 (permalink)
Scott Walters
Guest


 

Re: statusbar textblock update in long running operation

Are you saying the long running operation should run in a second thread
with a sync context so it can update the status bar ui on it's thread?

If there's no other way, I guess that's what I have to do...but it seems
like I should be able to call into the framework from the UI thread and
tell it to refresh/repaint the status bar contents.

Radek Cerny wrote:
> It needs to be on a different thread - best way is probably to spawn a new
> thread on button click. Plenty of examples around.
>
> "Scott Walters" <scottw512@hotmail.com> wrote in message
> news:O1CkIyUzHHA.3400@TK2MSFTNGP03.phx.gbl...
>> I have a status bar on my window that contains a TextBlock. I am trying to
>> update the text in the textblock during a long operation that's running
>> inside a button click handler on the same window. The text doesn't update
>> until the end, which is not what I want. I've tried several combinations of
>> InvalidateArrange(), InvalidateVisual() and UpdateLayout() on both the
>> TextBlock and it's parent StatusBar without success. How can I do this?
>>
>> Thanks,
>> Scott

>
>

My System SpecsSystem Spec
Old 07-26-2007   #4 (permalink)
Radek Cerny
Guest


 

Re: statusbar textblock update in long running operation

Its actually internally very complex, but externally simple, and the simple
answer is no. If the UI thread is busy, nothing will redraw.

"Scott Walters" <scottw512@hotmail.com> wrote in message
news:OOb$oA4zHHA.5160@TK2MSFTNGP05.phx.gbl...
> Are you saying the long running operation should run in a second thread
> with a sync context so it can update the status bar ui on it's thread?
>
> If there's no other way, I guess that's what I have to do...but it seems
> like I should be able to call into the framework from the UI thread and
> tell it to refresh/repaint the status bar contents.
>
> Radek Cerny wrote:
>> It needs to be on a different thread - best way is probably to spawn a
>> new thread on button click. Plenty of examples around.
>>
>> "Scott Walters" <scottw512@hotmail.com> wrote in message
>> news:O1CkIyUzHHA.3400@TK2MSFTNGP03.phx.gbl...
>>> I have a status bar on my window that contains a TextBlock. I am trying
>>> to update the text in the textblock during a long operation that's
>>> running inside a button click handler on the same window. The text
>>> doesn't update until the end, which is not what I want. I've tried
>>> several combinations of InvalidateArrange(), InvalidateVisual() and
>>> UpdateLayout() on both the TextBlock and it's parent StatusBar without
>>> success. How can I do this?
>>>
>>> Thanks,
>>> Scott

>>


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Running C# (.NET Framework 2.0) Application from long path (>127)crashes! Stefan Pascal .NET General 1 06-05-2008 09:42 AM
Why would the statusbar and Go To functionality be inactive in not klegg Vista General 3 05-10-2007 04:26 PM
Running disk defragmenter again still takes long Mickey Segal Vista performance & maintenance 4 04-09-2007 11:52 PM
A Friendly Warning for those of you Running Windows Long Horn Server Build 6001. Kevin John Panzke Vista General 15 02-16-2007 02:45 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51