Language: C#
C# code illustrating possible future CompositionInitializer changes
using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; using System.ComponentModel.Composition.Deployment; namespace Setting_up_the_host_to_download_catalogs { public class App: Application { public void Initialize() { var catalog1 = new DeploymentCatalog("Xap1.xap"); var catalog2 = new DeploymentCatalog("Xap2.xap"); CompositionHost.Initialize(catalog1, catalog2); } } } namespace Setting_up_the_host_to_download_catalogs_and_track_progress { public class App : Application { public void Initialize() { var catalog1 = new DeploymentCatalog(new Uri("Xap1.xap", UriKind.Relative), DownloadProgress); var catalog2 = new DeploymentCatalog(new Uri("Xap2.xap", UriKind.Relative), DownloadProgress); CompositionHost.Initialize(catalog1, catalog2); } private void DownloadProgress(CatalogDownloadProgress progress) { ShowProgress(progress.Uri, progress.DownloadedBytes, progress.TotalBytes); } private void ShowProgress(string uri, long downloadBytes, long totalBytes) { } } } namespace Setting_up_the_host_to_allow_parts_to_download_catalogs { public class App : Application { public void Initialize() { var catalog = new AggregateCatalog(); var container = CompositionHost.Initialize(catalog); container.ComposeExportedValue(new DeploymentCatalogService(catalog)); } } [Export] public class ModuleManager { [Import] DeploymentCatalogService CatalogService { get; set; } [ImportMany(AllowRecomposition = true)] public IModule[] Modules { get; set; } public ModuleManager() { CatalogService.Add(new DeploymentCatalog("Xap1.xap"), new DeploymentCatalog("Xap2.xap")); } } public class DeploymentCatalogService { public DeploymentCatalogService(AggregateCatalog catalog) { } public void Add(params DeploymentCatalog[] catalog) { } } public interface IModule { } } namespace Setting_up_a_host_part_to_download_catalogs { public class InfragisticsGrid { public void Initialize() { var catalog = new AggregateCatalog(); catalog.Catalogs.Add(new DeploymentCatalog()); //user extensions catalog.Catalogs.Add(new DeploymentCatalog("CoreGridCapabilities.xap")); catalog.Catalogs.Add(new DeploymentCatalog("CoreGridExtensions.xap")); var container = new CompositionContainer(catalog); container.ComposeParts(this); } [ImportMany] public IGridExtension[] Extensions { get; set; } [ImportMany] public ICapability[] Capabilities { get; set; } } public interface IGridExtension { }; public interface ICapability { }; } public class Application { }
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

