1 // -----------------------------------------------------------------------
\r
2 // Copyright (c) Microsoft Corporation. All rights reserved.
\r
3 // -----------------------------------------------------------------------
\r
5 using System.Collections.Generic;
\r
6 using System.Reflection;
\r
7 //using System.Windows;
\r
8 //using System.Windows.Resources;
\r
10 namespace System.ComponentModel.Composition
\r
12 public static partial class PartInitializer
\r
14 // This method is the only Silverlight specific code dependency in CompositionHost
\r
15 private static List<Assembly> GetAssemblyList()
\r
17 var assemblies = new List<Assembly>();
\r
19 // While this may seem like somewhat of a hack, walking the AssemblyParts in the active
\r
20 // deployment object is the only way to get the list of assemblies loaded by the XAP.
\r
22 foreach (AssemblyPart ap in Deployment.Current.Parts)
\r
24 StreamResourceInfo sri = Application.GetResourceStream(new Uri(ap.Source, UriKind.Relative));
\r
27 // Keep in mind that calling Load on an assembly that is already loaded will
\r
28 // be a no-op and simply return the already loaded assembly object.
\r
29 Assembly assembly = ap.Load(sri.Stream);
\r
30 assemblies.Add(assembly);
\r