コード例 #1
0
        protected override BaseFrameworkElement CreateElementOnStartDrag()
        {
            bool       flag       = true;
            Asset      asset      = this.Asset;
            TypeAsset  typeAsset  = asset as TypeAsset;
            StyleAsset styleAsset = asset as StyleAsset;

            if (typeAsset != null && typeAsset.Type is IUnreferencedType)
            {
                flag = false;
            }
            else if (styleAsset != null)
            {
                UserThemeAssetProvider themeAssetProvider = styleAsset.Provider as UserThemeAssetProvider;
                if (themeAssetProvider != null && !themeAssetProvider.IsLocal)
                {
                    flag = false;
                }
            }
            if (flag && asset.CanCreateInstance(this.ActiveSceneInsertionPoint))
            {
                return(this.CreateInstance(Rect.Empty) as BaseFrameworkElement);
            }
            return((BaseFrameworkElement)null);
        }
コード例 #2
0
 protected override StyleAsset GetRelatedUserThemeAsset(SceneNode node, SceneNode rootNode)
 {
     if (node == rootNode)
     {
         return(this.styleAsset);
     }
     return(StyleAsset.Find((IEnumerable)this.provider.Assets, (ITypeId)node.Type) ?? base.GetRelatedUserThemeAsset(node, rootNode));
 }
コード例 #3
0
ファイル: AssetTypeHelper.cs プロジェクト: radtek/Shopdrawing
        internal bool IsPrototypingStyle(StyleAsset styleAsset)
        {
            ResourceDictionaryAssetProvider dictionaryAssetProvider = styleAsset.Provider as ResourceDictionaryAssetProvider;

            if (dictionaryAssetProvider != null)
            {
                return((dictionaryAssetProvider.ResourceDictionaryUsage & ResourceDictionaryUsage.PrototypingStyles) != ResourceDictionaryUsage.Unknown);
            }
            return(false);
        }
コード例 #4
0
ファイル: AssetTypeHelper.cs プロジェクト: radtek/Shopdrawing
        internal bool IsStyleControlParts(StyleAsset styleAsset)
        {
            DocumentPrimitiveNode documentPrimitiveNode = ((DocumentCompositeNode)styleAsset.ResourceModel.ValueNode).Properties[DesignTimeProperties.IsControlPartProperty] as DocumentPrimitiveNode;

            if (documentPrimitiveNode != null)
            {
                return(documentPrimitiveNode.GetValue <bool>());
            }
            return(false);
        }
コード例 #5
0
ファイル: AssetTypeHelper.cs プロジェクト: radtek/Shopdrawing
 internal bool IsStyleLocal(StyleAsset styleAsset)
 {
     foreach (IProjectDocument projectDocument in (IEnumerable <IProjectDocument>) this.ProjectContext.Documents)
     {
         if (projectDocument.DocumentType != ProjectDocumentType.ResourceDictionary && projectDocument.DocumentRoot == styleAsset.ResourceModel.ValueNode.DocumentRoot)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #6
0
        public override bool IsResourceValid(ResourceModel resourceModel)
        {
            DocumentNode          keyNode   = resourceModel.KeyNode;
            DocumentCompositeNode valueNode = resourceModel.ValueNode as DocumentCompositeNode;
            bool flag = keyNode != null && valueNode != null && PlatformTypes.Style.IsAssignableFrom((ITypeId)valueNode.Type) && valueNode.Properties[StyleNode.TargetTypeProperty] != null;

            if (flag)
            {
                IType styleType = StyleAsset.GetStyleType(valueNode);
                if (styleType == null || styleType.RuntimeType == (Type)null || !TypeUtilities.HasDefaultConstructor(styleType.RuntimeType, false))
                {
                    flag = false;
                }
            }
            return(flag);
        }
コード例 #7
0
        public static bool ApplyActiveUserThemeStyle(SceneNode node)
        {
            IType type = node == null ? (IType)null : node.Type;

            if (type == null)
            {
                return(false);
            }
            StyleAsset activeUserThemeAsset = node.DesignerContext.AssetLibrary.FindActiveUserThemeAsset((ITypeId)type);

            if (activeUserThemeAsset != null)
            {
                return(activeUserThemeAsset.ApplyStyle(node));
            }
            return(false);
        }
コード例 #8
0
 public StyleAsset FindActiveUserThemeAsset(ITypeId type)
 {
     if (this.DesignerContext.ActiveProject != null && this.ActiveUserThemeProvider != null && this.ActiveUserThemeProvider.CanInsert(this.DesignerContext.ActiveProject))
     {
         IXamlProject xamlProject = this.DesignerContext.ActiveProject as IXamlProject;
         if (xamlProject == null || xamlProject.ProjectContext == null)
         {
             return((StyleAsset)null);
         }
         IType type1 = xamlProject.ProjectContext.ResolveType(type);
         if (type1 != null)
         {
             return(StyleAsset.Find((IEnumerable)this.ActiveUserThemeProvider.ThemeAssets, (ITypeId)type1));
         }
     }
     return((StyleAsset)null);
 }
コード例 #9
0
ファイル: StyleAsset.cs プロジェクト: radtek/Shopdrawing
        public static StyleAsset Find(IEnumerable assets, ITypeId unresolvedType)
        {
            IType type = (IType)null;

            foreach (object obj in assets)
            {
                StyleAsset styleAsset = obj as StyleAsset;
                if (styleAsset != null)
                {
                    if (type == null)
                    {
                        type = styleAsset.StyleType.PlatformMetadata.ResolveType(unresolvedType);
                    }
                    if (styleAsset.StyleType.Equals((object)type))
                    {
                        return(styleAsset);
                    }
                }
            }
            return((StyleAsset)null);
        }
コード例 #10
0
 public StyleAssetInstantiator(SceneView sceneView, StyleAssetProvider provider, StyleAsset styleAsset)
     : base(sceneView)
 {
     this.provider   = provider;
     this.styleAsset = styleAsset;
 }