BusyAnimiation... how to use?

BusyAnimiation... how to use?

Old forum URL: forums.lhotka.net/forums/t/5506.aspx


ajj3085 posted on Wednesday, October 01, 2008

Any examples on using the BusyAnimation in 3.6?

I'm trying something new in wpf applications... I want the UI to display as quickly as possible, and let the loading go on while my user controls are loading in the background.  I'm hoping the BusyAnimation will help..

So.. anyone use this yet?  What exactly does it do?

sergeyb replied on Wednesday, October 01, 2008

BusyAnymation simply displays an animation (moving circles) when IsRunning property is set to true.  You can find WPF example in ProjectRacker v3.6 in SVN.  It is used in ProjectEdit.xaml for example.

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: ajj3085 [mailto:cslanet@lhotka.net]
Sent: Wednesday, October 01, 2008 4:46 PM
To: Sergey Barskiy
Subject: [CSLA .NET] BusyAnimiation... how to use?

 

Any examples on using the BusyAnimation in 3.6?

I'm trying something new in wpf applications... I want the UI to display as quickly as possible, and let the loading go on while my user controls are loading in the background.  I'm hoping the BusyAnimation will help..

So.. anyone use this yet?  What exactly does it do?


ajj3085 replied on Wednesday, October 01, 2008

Guess Ill need an svn client... :-)

sergeyb replied on Wednesday, October 01, 2008

That is the easiest way. Tortoise SVN is one option.

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: ajj3085 [mailto:cslanet@lhotka.net]
Sent: Wednesday, October 01, 2008 4:58 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: BusyAnimiation... how to use?

 

Guess Ill need an svn client... :-)


ajj3085 replied on Thursday, October 02, 2008

Ok,

I must be missing something.  The animation doesn't show, even if I put a Thread.Sleep in the project's DataPortal_Update.

I think that's because IsAsyn was false on the CslaDataProvider... but when I set it to true, the user control disappears when I click save.

So what does it do?  Overload the user control and display a the circle animation?  That's pretty much what I'm looking for.. so if that's what it does I can just backport it to my Csla version and get started.

Andy

sergeyb replied on Thursday, October 02, 2008

You are correct about IsAsynch.  Busy animation will never show if there is a running process on main (UI) thread.  This is just a general UI rule though, not having much to do with busy animation.  So, if you want to show it for long running tasks, they must run on a background thread.  I am not sure why control would disappear, is there an exception thrown at some point?  I ran PT 3.6 this morning, and the animation does appear if provider is set to asynch.  I think I used Resources List? for testing.

 

Sergey Barskiy

Principal Consultant

office: 678.405.0687 | mobile: 404.388.1899

cid:_2_0648EA840648E85C001BBCB886257279
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: ajj3085 [mailto:cslanet@lhotka.net]
Sent: Thursday, October 02, 2008 9:32 AM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: RE: BusyAnimiation... how to use?

 

Ok,

I must be missing something.  The animation doesn't show, even if I put a Thread.Sleep in the project's DataPortal_Update.

I think that's because IsAsyn was false on the CslaDataProvider... but when I set it to true, the user control disappears when I click save.

So what does it do?  Overload the user control and display a the circle animation?  That's pretty much what I'm looking for.. so if that's what it does I can just backport it to my Csla version and get started.

Andy


ajj3085 replied on Thursday, October 02, 2008

No exception that I noticed... it just vanished, so you're left like the application after you first logon.

I was using the project edit screen to test.

RockfordLhotka replied on Thursday, October 02, 2008

The current ProjectList and ResourceList forms in PTWpf use BusyAnimation, maybe that'll help?

I had an issue where I couldn't see the control a couple days ago. Turned out it was two things. First, I didn't set a size, so it was essentially invisible. Second, my background is dark, and so is the animation, so it simply didn't have any contrast over the background.

You can change the style of the animation, or you can take the cheap way out (like I did) and put it inside a while container :)

ajj3085 replied on Friday, October 03, 2008

Ok, I'll check those controls as well.

I'm not sure what was happening; the project edit was visible up until I clicked Save, at which point it was gone.

I'm still kinda struggling with wpf... but mainly because I'm trying to go the user control route instead of having dozens of Forms specific to what I was doing.  Trying to par that down so that I have a list window, an edit window, and maybe a list select window.  Then I can just create an instance of an edit window and pop in the control.

Also, I'm trying to get the window to display as quickly as possible, even if disabled, until the data loads.

If anyone has done something similar, please let me know... any tips would be great!

Andy

RockfordLhotka replied on Friday, October 03, 2008

In many cases, to get a form loading before the data arrives, you can use IsAsynchronous=”True” on the data provider and let it do the work. The form will display,  and they’ll display data when the async data load completes.

 

This also allows you to bind a BusyAnimation to the data provider’s IsBusy property so the user knows something is happening.

 

The trick with WPF (and to some degree Silverlight) is to realize that nearly everything is bindable – as a source and target. Also, value converters are your friend because they allow you to change one (or more) property values into some other value.

 

For example, convert a Boolean into a Visibility, thus making it possible for a bool property to control whether the user sees entire parts of your UI.

 

Rocky

ajj3085 replied on Friday, October 03, 2008

Great, thanks!

Copyright (c) Marimer LLC