Will the Prism OnDemand module load in OOB mode?

Should loading OnDemand Prism modules work in an OOB environment? If so, I cannot get it to work. Everything currently works in the browser without any problems. In particular, I: register my modules in code:

    protected override IModuleCatalog GetModuleCatalog() {
        var catalog = new ModuleCatalog();
        Uri source;

        if( Application.Current.IsRunningOutOfBrowser ) {
            source = IsolatedStorageSettings.ApplicationSettings[SOURCEURI] as Uri;
        }
        else {
            var src = Application.Current.Host.Source.ToString();
            src = src.Substring( 0, src.LastIndexOf( '/' ) + 1 );
            source = new Uri( src );
            IsolatedStorageSettings.ApplicationSettings[SOURCEURI] = source;
            IsolatedStorageSettings.ApplicationSettings.Save();
        }

        if( source != null ) {
            var mod2 = new ModuleInfo { InitializationMode = InitializationMode.OnDemand,
                          ModuleName = ModuleNames.mod2,
                          ModuleType = "mod2.Module, mod2.Directory, '1.0.0.0', Culture=neutral, PublicKeyToken=null" ),
                          Ref = ( new Uri( source, "mod2.xap" )).AbsoluteUri };

            catalog.AddModule( mod2 );
        }

// per Jeremy Likeness - did not help.
        Application.Current.RootVisual = new Grid();

        return ( catalog );
    }

later request for loadable module:

mModuleManager.LoadModule( ModuleNames.mod2 );

and wait for the response to the event published during the initialization of this loaded module.

The module never loads, and when the application is running under the debugger, a message box appears saying that the web server returned a "not found" error. I can take the requesting url for the module and enter it in Firefox and load the module without problems.

, , , . , , - Jeremy Likeness, MEF, .

localhost ( , , ). clientaccesspolicy.xml - , . :

WebRequest.RegisterPrefix( Current.Host.Source.GetComponents( UriComponents.SchemeAndServer, UriFormat.UriEscaped ), WebRequestCreator.ClientHttp );

:

xaps - - xap? appmanifest.xml -??

, application.xap, xaps ?

+5
2

. , , .

, , .xap , Shell.

, Damian

+1

Prism , Prism . - , , HTTP, .

Prism Microsoft.Practices.Composite.Modularity.XapModuleTypeLoader. Prism, Microsoft.Practices.Composite.Modularity.FileDownloader, .xap; , - .

- XapModuleTypeLoader , :

public static Type DownloaderType { get; set; }

CreateDownloader(), , :

protected virtual IFileDownloader CreateDownloader() {
    if (_downloader == null) { 
        if (DownloaderType == null) {
            _downloader = new FileDownloader();
        } else { 
            _downloader = (IFileDownloader)Activator.CreateInstance(DownloaderType);
        }
    }

    return _downloader;
}

, :

XapModuleTypeLoader.DownloaderType = typeof(LocalFileDownloader);

Voila - Prism .

LocalFileDownloader, , , .xap , ... , Prism FileDownloader, .

, clientaccesspolicy.xml, , , URL-, , , , .

. , . , , .NET 2.0. .xap * ( ), / , , . sllauncher.exe, Silverlight. : http://timheuer.com/blog/archive/2010/03/25/using-sllauncher-for-silent-install-silverlight-application.aspx.

, , .xaps SL, - . " " -, , .

* .xap - 2/3 . .xaps , " ", .xaps, . , .

0

All Articles