none
Problem with navigating using MEF.

    Question

  • Hi,
    I've a custom content loader that dynamically downloads the appropriate XAP file and uses MEF to load the pages like the one that Glenn Block demonstrated. I've also wanted to have transition effect between navigating pages, so I've inherited from the Frame element and implemented 2 visual states and using Visual State Manager in the Navigated event of the frame, I begin the transition animation (using GoToState method).
    The problem is when the creation of pages takes more than an empty or very simple one, even though the Navigated event is not fired it seems that the animations are executed.
    I've deliberately put a Thread.Sleep just before I complete the navigation for 3 seconds. The hole transition effect is about 1 seconds and when the Navigated event fires the animation, it is reached to its end frame.
    Can anyone knows why this is happening?
    Thanks.

    Hi,

    I've a custom content loader that dynamically downloads the appropriate XAP file and uses MEF to load the pages like the one that Glenn Block demonstrated. I've also wanted to have transition effect between navigating pages, so I've inherited from the Frame element and implemented 2 visual states and using Visual State Manager in the Navigated event of the frame, I begin the transition animation (using GoToState method).

    The problem is when the creation of pages takes more than an empty or very simple one, even though the Navigated event is not fired it seems that the animations are executed.

    I've deliberately put a Thread.Sleep just before I complete the navigation for 3 seconds. The hole transition effect is about 1 seconds and when the Navigated event fires the animation, it is reached to its end frame.

    Can anyone knows why this is happening?

    Thanks.


    Sunday, January 23, 2011 3:30 AM

Answers

  • Hi Peter, thanks for your answer. I'm sorry if I wasn't clear. I've found the solution and It has nothing to do with MEF! I should've updated the post. Anyhow, for here's the link to the solution http://forums.silverlight.net/forums/t/217045.aspx
    Wednesday, March 30, 2011 4:37 AM

All replies

  • Hi mrtaikandi,

    It is not completely clear what you mean to achieve and what your problem is. On one hand you say you want animation, on the other hand you say that the animation takes place. What exactly is the question/problem?

    What perhaps is going on is the following:

    Because MEF makes a difference in several life-time stadia of the Module, the animation may have gone lost in that process. It depends on when the animation is triggered.

    MEF does the following 4 basic things:

    - registering a Module

    - discovering a Module

    - loading a Module

    - initialize a Module

    When the Module is in memory already (so it has been loaded), then it will not take a long time to have the UI showing. Then the animation probably will be viewable. But when the module is not yet in memory, the 1 second probably is too short to be seen, because it takes some time to discover and load the module. This could be the case, because you say that your content loader DYNAMICALLY downloads XAP's.

    here's some good video on this (also look at episode 5 of the series!)

    http://channel9.msdn.com/Shows/SilverlightTV/Silverlight-TV-Episode-4-3-Steps-to-MEF-Export-Import-Compose

    and this one:

    http://channel9.msdn.com/Blogs/matthijs/Silverlight-4-A-Guided-Tour-of-the-Managed-Extensibility-Framework-MEF

    Hope this helps you to get on the right track!

    Cheers!

    Peter

    Sunday, March 27, 2011 6:10 AM
  • Hi Peter, thanks for your answer. I'm sorry if I wasn't clear. I've found the solution and It has nothing to do with MEF! I should've updated the post. Anyhow, for here's the link to the solution http://forums.silverlight.net/forums/t/217045.aspx
    Wednesday, March 30, 2011 4:37 AM