Esempio n. 1
0
 public void MePullParser_Parse ()
 {
     const string me = "{Binding 1, 2, Path=Name, Converter={StaticResource MyRes}, ConverterParameter={x:Static Window.LeftProperty}}";
     var xamlGenerator = new XamlGenerator(null, null, null);
     var xamlSchema = new XamlSchemaContext( /*new[] { PresentationCore, PresentationFramework }*/);
     var xamlContext = new XamlParserContext(xamlSchema, GetType().Assembly);
     xamlContext.AddNamespacePrefix("", xamlGenerator.Ns.NamespaceName);
     xamlContext.AddNamespacePrefix("x", xamlGenerator.NsX.NamespaceName);
     var meParser = new MePullParser(xamlContext);
     var sb = new StringBuilder();
     foreach (XamlNode xamlNode in meParser.Parse(me, 0, 0))
         sb.AppendFormat("{0}\n", xamlNode);
     //throw new Exception(SR.Get("MissingImplicitPropertyTypeCase"));
     throw new Exception(sb.ToString());
 }
Esempio n. 2
0
            public ObjectContext (XamlGenerator generator, JObject jobj)
            {
                JObj = jobj;

                TokenTypeInfo parentInfo = generator.GetTypeInfo(JObj.Parent);
                TypeInfo = generator.GetTypeInfo(JObj);
                if (TypeInfo.Type == null)
                    TypeInfo.Type = parentInfo.PropertyItemType;
                if (TypeInfo.PropertyContainerType == null)
                    TypeInfo.PropertyContainerType = parentInfo.PropertyType;

                string visibility, typeName, objId;
                ParseDollarField((string)JObj[pnDollar], out visibility, out typeName, out objId);
                Visibility = visibility;
                ObjId = objId;
                if (typeName != null) {
                    TypeInfo.Type = generator.GetTypeByName(typeName);
                    TypeName = typeName;
                }
                else if (TypeInfo.Type != null) {
                    TypeName = TypeInfo.Type.Name;
                }
            }
Esempio n. 3
0
 public void XamlGenerator_GenerateXaml_MainWin ()
 {
     var jobj = JObject.Parse(File.ReadAllText("../../../Alba.JamlTestApp/MainWin.jaml").Substring(2));
     var generator = new XamlGenerator(jobj, "Alba.Test.Jaml", "MainWin");
     generator.GenerateXaml();
 }
Esempio n. 4
0
 public TokenTypeInfo (XamlGenerator generator)
 {
     _generator = generator;
 }