Esempio n. 1
0
        private DynamicActivityXamlType CreateXamlType(string path)
        {
            XamlNodeList xamlNodes = new XamlNodeList(this);

            using (XamlXmlReader xamlReader = new XamlXmlReader(path, this))
            {
                XamlServices.Transform(xamlReader, xamlNodes.Writer);
            }

            // Namespaces are only evaluated at construction, so if an additional namespace is
            // registered later, we don't update the XamlType.
            IEnumerable <string>    namespaces = GetNamespacesFor(path).OrderBy(ns => ns, StringComparer.Ordinal);
            DynamicActivityXamlType result     = new DynamicActivityXamlType(xamlNodes, namespaces);

            return(result);
        }
Esempio n. 2
0
        protected override DynamicActivityXamlType LookupXamlType(string xamlNamespace, string name)
        {
            string path = GetPathTo(xamlNamespace);

            if (path != null)
            {
                string fullPath = Path.Combine(path, name + ".xaml");
                DynamicActivityXamlType result = GetXamlType(fullPath);
                if (result.Name != name)
                {
                    throw new XamlSchemaException(string.Format(
                                                      "Activity at path {0} has name {1}; expected {2}.", fullPath, result.Name, name));
                }
                return(result);
            }
            return(null);
        }
Esempio n. 3
0
        private DynamicActivityXamlType TryAddXamlType(XName qualifiedName, DynamicActivityXamlType type)
        {
            XName clrName = XName.Get(type.Name, type.ClrNamespace);

            if (!_types.TryAdd(clrName, type))
            {
                type = _types[clrName];
            }
            if (qualifiedName.NamespaceName != type.ClrNamespace)
            {
                bool typeIsAlreadyRegistered = !_types.TryAdd(qualifiedName, type);
                if (typeIsAlreadyRegistered && _types[qualifiedName] != type)
                {
                    string oldClassName = _types[qualifiedName].Descriptor.GetClassName();
                    string newClassName = type.Descriptor.GetClassName();
                    Debug.Assert(oldClassName != newClassName, "Only one type should ever be registered for a given class name");
                    throw new XamlSchemaException(string.Format("Cannot map {0} to {1} because it is already mapped to {2}.",
                                                                qualifiedName, newClassName, oldClassName));
                }
            }
            return(type);
        }
 private DynamicActivityXamlType TryAddXamlType(XName qualifiedName, DynamicActivityXamlType type)
 {
     XName clrName = XName.Get(type.Name, type.ClrNamespace);
     if (!_types.TryAdd(clrName, type))
     {
         type = _types[clrName];
     }
     if (qualifiedName.NamespaceName != type.ClrNamespace)
     {
         bool typeIsAlreadyRegistered = !_types.TryAdd(qualifiedName, type);
         if (typeIsAlreadyRegistered && _types[qualifiedName] != type)
         {
             string oldClassName = _types[qualifiedName].Descriptor.GetClassName();
             string newClassName = type.Descriptor.GetClassName();
             Debug.Assert(oldClassName != newClassName, "Only one type should ever be registered for a given class name");
             throw new XamlSchemaException(string.Format("Cannot map {0} to {1} because it is already mapped to {2}.",
                 qualifiedName, newClassName, oldClassName));
         }
     }
     return type;
 }
        private DynamicActivityXamlType CreateXamlType(string path)
        {
            XamlNodeList xamlNodes = new XamlNodeList(this);
            using (XamlXmlReader xamlReader = new XamlXmlReader(path, this))
            {
                XamlServices.Transform(xamlReader, xamlNodes.Writer);
            }

            // Namespaces are only evaluated at construction, so if an additional namespace is
            // registered later, we don't update the XamlType.
            IEnumerable<string> namespaces = GetNamespacesFor(path).OrderBy(ns => ns, StringComparer.Ordinal);
            DynamicActivityXamlType result = new DynamicActivityXamlType(xamlNodes, namespaces);
            return result;
        }
 public DynamicActivityInvoker(DynamicActivityXamlType xamlType)
     : base(xamlType)
 {
     _xamlType = xamlType;
 }
 public DynamicActivityInvoker(DynamicActivityXamlType xamlType)
     : base(xamlType)
 {
     _xamlType = xamlType;
 }