wpf - How to correctly coordinate Windows load animations and C# events? -


my wpf application has window load animation created using blend. actual animation works fine, if add logic window load event (using c#) animation skips end when window renders.

my initial plan use threading solve this, didn't work:

private void mywindow_loaded(object sender, routedeventargs e) {      dispatchertimer.tick += new eventhandler(dispatchertimer_tick);     dispatchertimer.interval = new timespan(0, 0, 30);     dispatchertimer.start();      lstrecipients.visibility = visibility.hidden;      windowadorner = new transparentadorner(bordergrid);      if (!statichelpers.awsconfigurationexists())     {         this.isenabled = false;         gettingstarted gettingstarted = new gettingstarted(this);         gettingstarted.owner = this;         gettingstarted.showdialog();         this.isenabled = true;     }     else     {         task setawslabelstask = new task(new action(() => setawslabels()));         setawslabelstask.start();      }      task bouncehandler = new task(new action(() => processbounce()));     bouncehandler.start();     //processbounce();      task unsubscribehandler = new task(new action(() => handleunsubscriptions()));     unsubscribehandler.start();  } 

i'm assuming system busy creating threads, , creation handled ui thread, animation has finished time window rendered.

what i'm missing way coordinate animation, business logic have in mywindow_loaded occurs after animation has finished loading.

is possible?

edit: tried thread sleep, , didn't work.

ok solved problem.

in xaml added new event handler storyboard:

<storyboard x:key="seslogoload" completed="storycompleted"> 

then created method manually using c#:

private void storycompleted(object sender, eventargs e) { //windows onload stuff goes here... } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -