Prism Modularity & Silverlight 3 OOB

Topics: Prism v2 - Silverlight 3
Apr 1, 2010 at 4:11 AM
Edited Apr 1, 2010 at 4:16 AM

Hello,

     I'm testing out a very simple prism app that is installed out of browser (OOB).   I'm finding that the modules seem to load very inconsistently and sometimes, apparently not at all.   Here is a screencast showing what's happening:  http://screencast.com/t/Y2UzMjNkZmYt

It's a pretty vanilla configuration:

 

protected override IModuleCatalog GetModuleCatalog()
        {
            return ModuleCatalog.CreateFromXaml(
                        new Uri( "/PrismQuickStartSoution-Shell;component/ModuleCatalog.xaml",
                        UriKind.Relative ) );
        }

 

 

...and the ModuleCatalog.xaml:

 

<prism:ModuleCatalog xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:prism="clr-namespace:Microsoft.Practices.Composite.Modularity;assembly=Microsoft.Practices.Composite">

    <prism:ModuleInfo Ref="PrismQuickStartSoution-Module1.xap"
                      ModuleName="Module1"
                      ModuleType="Prism.Samples.Module1.ModuleInit, PrismQuickStartSoution-Module1, Version=1.0.0.0"
                      InitializationMode="WhenAvailable"/>

    <prism:ModuleInfo Ref="PrismQuickStartSoution-Module2.xap"
                      ModuleName="Module2"
                      ModuleType="Prism.Samples.Module2.ModuleInit, PrismQuickStartSoution-Module2, Version=1.0.0.0"
                      InitializationMode="WhenAvailable">
        <prism:ModuleInfo.DependsOn>
            <sys:String>Module1</sys:String>
        </prism:ModuleInfo.DependsOn>
    </prism:ModuleInfo>

</prism:ModuleCatalog>

 

Any idea what might be going on?

Thanks!

-James

Apr 2, 2010 at 1:25 AM

I am not using the xml file for now. I add the modules in my code and use ModuleManager.Run() when I have all catalogs I need in the ModuleCatalog object.

Not sure if you did this already but try changing the InitializationMode to OnDemand and initialize modules once the shell is loaded. Its probably worth a shot.

 

Apr 5, 2010 at 5:29 PM

Hi James,

A possible reason for this to happen could be that the modules are loaded remotely and are in different .xap files, since .xap files that don’t appear in the main application aren’t added to the out-of-browser cache. Possible approaches to workaround this issue could be:

  • Creating a XapCachingModuleTypeLoader that will download to Isolated Storage and check there first for .xap files. After the files are cached the OOB application should be able to load the modules.
  • Including the modules in the main .xap.

Please let me know if this helps.

Damian Schenkelman
http://blogs.southworks.net/dschenkelman

Apr 6, 2010 at 2:40 AM

Thanks Aditya and Damian!  I'll have to look into these.