Dan Soltesz

Dan Soltesz dsoltesz

Niner since 2010

Comments

  • Silverlight TV 11: Dynamically Loading XAPs with MEF

    Ran into an issue with composition happening more than once for a given element and that's because I was using page navigation and if the user navigated to a page, navigated away and then return to page, I was trying to load xap again.  So what I did is made a change to the AddXap method to check if the aggregateCatalog already contains the deploymentCatalog

     

     

    public void AddXap(string uri)

    {

        DeploymentCatalog catalog;

        if (!_catalogs.TryGetValue(uri, out catalog))

        {

            catalog = new DeploymentCatalog(uri);

            catalog.DownloadAsync();

            _catalogs[uri] = catalog;

        }

        if (!_aggregateCatalog.Catalogs.Contains(catalog))

        {

            _aggregateCatalog.Catalogs.Add(catalog);

        }

    }