コード例 #1
0
        public static void AddToolkitReferenceIfNeeded(ITypeResolver typeResolver, ViewUpdateManager viewUpdateManager)
        {
            if (typeResolver == null || !typeResolver.IsCapabilitySet(PlatformCapability.VsmInToolkit) || !typeResolver.IsCapabilitySet(PlatformCapability.SupportsVisualStateManager))
            {
                return;
            }
            string toolkitPath = ToolkitHelper.GetToolkitPath();

            if (string.IsNullOrEmpty(toolkitPath))
            {
                return;
            }
            typeResolver.EnsureAssemblyReferenced(toolkitPath);
            viewUpdateManager.RebuildPostponedViews();
        }
コード例 #2
0
 public ToolkitProjectContext(IProjectContext sourceContext)
     : base(sourceContext, (ICollection <IAssembly>)null)
 {
     this.CustomAssemblyReferences = (ICollection <IAssembly>) new List <IAssembly>();
     if (!sourceContext.PlatformMetadata.IsNullType((ITypeId)sourceContext.ResolveType(ProjectNeutralTypes.VisualStateManager)) || !sourceContext.IsCapabilitySet(PlatformCapability.VsmInToolkit))
     {
         return;
     }
     if (!sourceContext.IsCapabilitySet(PlatformCapability.SupportsVisualStateManager))
     {
         return;
     }
     try
     {
         Assembly assembly = ProjectAssemblyHelper.LoadFile(ToolkitHelper.GetToolkitPath());
         this.CustomAssemblyReferences = (ICollection <IAssembly>) new List <IAssembly>(1)
         {
             sourceContext.Platform.Metadata.CreateAssembly(assembly, AssemblySource.PlatformExtension)
         };
     }
     catch (Exception ex)
     {
     }
 }