Merge branch '3.0.0'
|
@ -1,11 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Embedding.iOS</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.companyname.Embedding.iOS</string>
|
||||
<string>com.xamarin.Embedding.iOS</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
@ -42,4 +42,4 @@
|
|||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
</plist>
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>PagesGallery</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourcompany.PagesGallery</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string>Icon-60@2x</string>
|
||||
<string>Icon-60@3x</string>
|
||||
<string>Icon-76</string>
|
||||
<string>Icon-76@2x</string>
|
||||
<string>Default</string>
|
||||
<string>Default@2x</string>
|
||||
<string>Default-568h@2x</string>
|
||||
<string>Default-Portrait</string>
|
||||
<string>Default-Portrait@2x</string>
|
||||
<string>Icon-Small-40</string>
|
||||
<string>Icon-Small-40@2x</string>
|
||||
<string>Icon-Small-40@3x</string>
|
||||
<string>Icon-Small</string>
|
||||
<string>Icon-Small@2x</string>
|
||||
<string>Icon-Small@3x</string>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>PagesGallery</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.PagesGallery</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string>Icon-60@2x</string>
|
||||
<string>Icon-60@3x</string>
|
||||
<string>Icon-76</string>
|
||||
<string>Icon-76@2x</string>
|
||||
<string>Default</string>
|
||||
<string>Default@2x</string>
|
||||
<string>Default-568h@2x</string>
|
||||
<string>Default-Portrait</string>
|
||||
<string>Default-Portrait@2x</string>
|
||||
<string>Icon-Small-40</string>
|
||||
<string>Icon-Small-40@2x</string>
|
||||
<string>Icon-Small-40@3x</string>
|
||||
<string>Icon-Small</string>
|
||||
<string>Icon-Small@2x</string>
|
||||
<string>Icon-Small@3x</string>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d6c60296e83bf9111f3f8e9d9382e2d27c0d8746
|
||||
Subproject commit ac0d39633351e934f72541f60e61a29eac69707b
|
|
@ -1,7 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
@ -20,14 +17,19 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
if (IsNullOrEmpty(value))
|
||||
throw new XamlParseException($"Cannot convert \"{value}\" into {typeof(Binding)}", node);
|
||||
|
||||
var bindingCtorRef = module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Binding"), paramCount: 6);
|
||||
yield return Instruction.Create(OpCodes.Ldstr, value);
|
||||
yield return Instruction.Create(OpCodes.Ldc_I4, (int)BindingMode.Default);
|
||||
yield return Instruction.Create(OpCodes.Ldnull);
|
||||
yield return Instruction.Create(OpCodes.Ldnull);
|
||||
yield return Instruction.Create(OpCodes.Ldnull);
|
||||
yield return Instruction.Create(OpCodes.Ldnull);
|
||||
yield return Instruction.Create(OpCodes.Newobj, bindingCtorRef);
|
||||
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Binding"), parameterTypes: new[] {
|
||||
("mscorlib", "System", "String"),
|
||||
("Xamarin.Forms.Core", "Xamarin.Forms", "BindingMode"),
|
||||
("Xamarin.Forms.Core", "Xamarin.Forms", "IValueConverter"),
|
||||
("mscorlib", "System", "Object"),
|
||||
("mscorlib", "System", "String"),
|
||||
("mscorlib", "System", "Object")}));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -67,9 +67,11 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
yield return Instruction.Create(OpCodes.Ldc_R8, y);
|
||||
yield return Instruction.Create(OpCodes.Ldc_R8, w);
|
||||
yield return Instruction.Create(OpCodes.Ldc_R8, h);
|
||||
|
||||
var rectangleCtorRef = module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Rectangle"), paramCount: 4);
|
||||
yield return Instruction.Create(OpCodes.Newobj, rectangleCtorRef);
|
||||
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Rectangle"), parameterTypes: new[] {
|
||||
("mscorlib", "System", "Double"),
|
||||
("mscorlib", "System", "Double"),
|
||||
("mscorlib", "System", "Double"),
|
||||
("mscorlib", "System", "Double")}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,10 +29,11 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
yield return Instruction.Create(OpCodes.Ldc_R8, color.B);
|
||||
yield return Instruction.Create(OpCodes.Ldc_R8, color.A);
|
||||
|
||||
var colorCtorRef = module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Color"),
|
||||
paramCount: 4,
|
||||
predicate: md => md.Parameters.All(p => p.ParameterType.FullName == "System.Double"));
|
||||
yield return Instruction.Create(OpCodes.Newobj, colorCtorRef);
|
||||
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Color"), parameterTypes: new[] {
|
||||
("mscorlib", "System", "Double"),
|
||||
("mscorlib", "System", "Double"),
|
||||
("mscorlib", "System", "Double"),
|
||||
("mscorlib", "System", "Double")}));
|
||||
yield break;
|
||||
}
|
||||
var parts = value.Split('.');
|
||||
|
@ -41,14 +42,12 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
|
||||
var fieldReference = module.ImportFieldReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Color"),
|
||||
color,
|
||||
fd => fd.IsStatic);
|
||||
isStatic: true);
|
||||
if (fieldReference != null) {
|
||||
yield return Instruction.Create(OpCodes.Ldsfld, fieldReference);
|
||||
yield break;
|
||||
}
|
||||
var propertyGetterReference = module.ImportPropertyGetterReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Color"),
|
||||
color,
|
||||
pd => pd.GetMethod.IsStatic);
|
||||
var propertyGetterReference = module.ImportPropertyGetterReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Color"), color, isStatic: true);
|
||||
if (propertyGetterReference != null) {
|
||||
yield return Instruction.Create(OpCodes.Call, propertyGetterReference);
|
||||
yield break;
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
|
||||
using Xamarin.Forms.Xaml;
|
||||
using Xamarin.Forms.Build.Tasks;
|
||||
|
||||
using static Mono.Cecil.Cil.Instruction;
|
||||
using static Mono.Cecil.Cil.OpCodes;
|
||||
|
||||
namespace Xamarin.Forms.Core.XamlC
|
||||
{
|
||||
class ConstraintTypeConverter : ICompiledTypeConverter
|
||||
|
@ -21,12 +22,11 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
if (string.IsNullOrEmpty(value) || !double.TryParse(value, NumberStyles.Number, CultureInfo.InvariantCulture, out size))
|
||||
throw new XamlParseException($"Cannot convert \"{value}\" into {typeof(Constraint)}", node);
|
||||
|
||||
yield return Instruction.Create(OpCodes.Ldc_R8, size);
|
||||
var constantReference = module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Constraint"),
|
||||
methodName: "Constant",
|
||||
paramCount: 1,
|
||||
predicate: md => md.IsStatic);
|
||||
yield return Instruction.Create(OpCodes.Call, constantReference);
|
||||
yield return Create(Ldc_R8, size);
|
||||
yield return Create(Call, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Constraint"),
|
||||
methodName: "Constant",
|
||||
parameterTypes: new[] { ("mscorlib", "System", "Double") },
|
||||
isStatic: true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
|
||||
var fieldReference = module.ImportFieldReference(("Xamarin.Forms.Core", "Xamarin.Forms", "LayoutOptions"),
|
||||
fieldName: options,
|
||||
predicate: fd => fd.IsStatic);
|
||||
isStatic: true);
|
||||
if (fieldReference != null) {
|
||||
yield return Instruction.Create(OpCodes.Ldsfld, fieldReference);
|
||||
yield break;
|
||||
|
|
|
@ -2,12 +2,14 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
|
||||
using Xamarin.Forms.Xaml;
|
||||
using Xamarin.Forms.Build.Tasks;
|
||||
|
||||
using static Mono.Cecil.Cil.Instruction;
|
||||
using static Mono.Cecil.Cil.OpCodes;
|
||||
|
||||
namespace Xamarin.Forms.Core.XamlC
|
||||
{
|
||||
class ListStringTypeConverter : ICompiledTypeConverter
|
||||
|
@ -17,25 +19,22 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
var module = context.Body.Method.Module;
|
||||
|
||||
if (value == null) {
|
||||
yield return Instruction.Create(OpCodes.Ldnull);
|
||||
yield return Create(Ldnull);
|
||||
yield break;
|
||||
}
|
||||
var parts = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).ToList();
|
||||
|
||||
var add = module.ImportMethodReference(("mscorlib", "System.Collections.Generic", "ICollection`1"),
|
||||
methodName: "Add",
|
||||
paramCount: 1,
|
||||
classArguments: new[] { ("mscorlib", "System", "String") });
|
||||
|
||||
yield return Instruction.Create(OpCodes.Ldc_I4, parts.Count);
|
||||
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(("System.Collections", "System.Collections.Generic", "List`1"),
|
||||
paramCount: 1,
|
||||
predicate: md => md.Parameters[0].ParameterType.FullName == "System.Int32",
|
||||
classArguments: new[] { ("mscorlib", "System", "String") }));
|
||||
yield return Create(Ldc_I4, parts.Count);
|
||||
yield return Create(Newobj, module.ImportCtorReference(("System.Collections", "System.Collections.Generic", "List`1"),
|
||||
parameterTypes: new[] { ("mscorlib", "System", "Int32") },
|
||||
classArguments: new[] { ("mscorlib", "System", "String") }));
|
||||
foreach (var part in parts) {
|
||||
yield return Instruction.Create(OpCodes.Dup);
|
||||
yield return Instruction.Create(OpCodes.Ldstr, part);
|
||||
yield return Instruction.Create(OpCodes.Callvirt, add);
|
||||
yield return Create(Dup);
|
||||
yield return Create(Ldstr, part);
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("mscorlib", "System.Collections.Generic", "ICollection`1"),
|
||||
methodName: "Add",
|
||||
paramCount: 1,
|
||||
classArguments: new[] { ("mscorlib", "System", "String") }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,13 +49,15 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
yield return Create(Stloc, uriVarDef);
|
||||
yield return Create(Ldstr, resourcePath); //resourcePath
|
||||
yield return Create(Ldtoken, module.ImportReference(((ILRootNode)rootNode).TypeReference));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", paramCount: 1, predicate: md => md.IsStatic));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System.Reflection", "IntrospectionExtensions"), methodName: "GetTypeInfo", paramCount: 1, predicate: md => md.IsStatic));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System.Reflection", "IntrospectionExtensions"), methodName: "GetTypeInfo", parameterTypes: new[] { ("mscorlib", "System", "Type") }, isStatic: true));
|
||||
yield return Create(Callvirt, module.ImportPropertyGetterReference(("mscorlib", "System.Reflection", "TypeInfo"), propertyName: "Assembly", flatten: true));
|
||||
|
||||
foreach (var instruction in node.PushXmlLineInfo(context))
|
||||
yield return instruction; //lineinfo
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "ResourceDictionary"), methodName: "SetAndLoadSource", paramCount: 4));
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "ResourceDictionary"),
|
||||
methodName: "SetAndLoadSource",
|
||||
parameterTypes: new[] { ("System", "System", "Uri"), ("mscorlib", "System", "String"), ("mscorlib", "System.Reflection", "Assembly"), ("System.Xml.ReaderWriter", "System.Xml", "IXmlLineInfo") }));
|
||||
//ldloc the stored uri as return value
|
||||
yield return Create(Ldloc, uriVarDef);
|
||||
}
|
||||
|
|
|
@ -42,8 +42,11 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
yield return Instruction.Create(OpCodes.Ldc_R8, y);
|
||||
yield return Instruction.Create(OpCodes.Ldc_R8, w);
|
||||
yield return Instruction.Create(OpCodes.Ldc_R8, h);
|
||||
|
||||
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Rectangle"), paramCount: 4));
|
||||
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Rectangle"), parameterTypes: new[] {
|
||||
("mscorlib", "System", "Double"),
|
||||
("mscorlib", "System", "Double"),
|
||||
("mscorlib", "System", "Double"),
|
||||
("mscorlib", "System", "Double")}));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,8 +45,7 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
{
|
||||
foreach (var d in args)
|
||||
yield return Instruction.Create(OpCodes.Ldc_R8, d);
|
||||
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Thickness"),
|
||||
paramCount: args.Length));
|
||||
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms", "Thickness"), parameterTypes: args.Select(a => ("mscorlib", "System", "Double")).ToArray()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,12 +2,14 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
|
||||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
|
||||
using Xamarin.Forms.Build.Tasks;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
using static Mono.Cecil.Cil.Instruction;
|
||||
using static Mono.Cecil.Cil.OpCodes;
|
||||
|
||||
namespace Xamarin.Forms.Core.XamlC
|
||||
{
|
||||
class TypeTypeConverter : ICompiledTypeConverter
|
||||
|
@ -33,8 +35,11 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
if (typeRef == null)
|
||||
goto error;
|
||||
|
||||
yield return Instruction.Create(OpCodes.Ldtoken, module.ImportReference(typeRef));
|
||||
yield return Instruction.Create(OpCodes.Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", paramCount: 1, predicate: md => md.IsStatic));
|
||||
yield return Create(Ldtoken, module.ImportReference(typeRef));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"),
|
||||
methodName: "GetTypeFromHandle",
|
||||
parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") },
|
||||
isStatic: true));
|
||||
|
||||
yield break;
|
||||
|
||||
|
|
|
@ -24,12 +24,11 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
yield break;
|
||||
}
|
||||
|
||||
var uriCtorRef = module.ImportCtorReference(("System", "System", "Uri"),
|
||||
paramCount: 2,
|
||||
predicate: md => md.Parameters[1].ParameterType.FullName == "System.UriKind");
|
||||
yield return Create(Ldstr, value);
|
||||
yield return Create(Ldc_I4_0); //UriKind.RelativeOrAbsolute
|
||||
yield return Create(Newobj, uriCtorRef);
|
||||
yield return Create(Newobj, module.ImportCtorReference(("System", "System", "Uri"), parameterTypes: new[] {
|
||||
("mscorlib", "System", "String"),
|
||||
("System", "System", "UriKind")}));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
|
||||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
|
||||
using Xamarin.Forms.Xaml;
|
||||
using System.Xml;
|
||||
|
||||
using static Mono.Cecil.Cil.Instruction;
|
||||
using static Mono.Cecil.Cil.OpCodes;
|
||||
|
||||
|
||||
namespace Xamarin.Forms.Build.Tasks
|
||||
{
|
||||
|
@ -29,15 +34,15 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
}
|
||||
|
||||
var typeref = module.ImportReference(XmlTypeExtensions.GetTypeReference(valueNode.Value as string, module, node as BaseNode));
|
||||
if (typeref == null)
|
||||
throw new XamlParseException($"Can't resolve type `{valueNode.Value}'.", node as IXmlLineInfo);
|
||||
|
||||
context.TypeExtensions[node] = typeref;
|
||||
context.TypeExtensions[node] = typeref ?? throw new XamlParseException($"Can't resolve type `{valueNode.Value}'.", node as IXmlLineInfo);
|
||||
|
||||
return new List<Instruction> {
|
||||
Instruction.Create(OpCodes.Ldtoken, module.ImportReference(typeref)),
|
||||
Instruction.Create(OpCodes.Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", paramCount: 1, predicate: md => md.IsStatic)),
|
||||
|
||||
Create(Ldtoken, module.ImportReference(typeref)),
|
||||
Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"),
|
||||
methodName: "GetTypeFromHandle",
|
||||
parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") },
|
||||
isStatic: true)),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using System.Xml;
|
||||
|
||||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
|
@ -13,7 +10,6 @@ using Xamarin.Forms.Xaml;
|
|||
using static Mono.Cecil.Cil.Instruction;
|
||||
using static Mono.Cecil.Cil.OpCodes;
|
||||
|
||||
|
||||
namespace Xamarin.Forms.Core.XamlC
|
||||
{
|
||||
class StyleSheetProvider : ICompiledValueProvider
|
||||
|
@ -48,8 +44,8 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
yield return Create(Ldstr, style);
|
||||
yield return Create(Call, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms.StyleSheets", "StyleSheet"),
|
||||
methodName: "FromString",
|
||||
paramCount: 1,
|
||||
predicate: md => md.IsStatic));
|
||||
parameterTypes: new[] { ("mscorlib", "System", "String") },
|
||||
isStatic: true));
|
||||
}
|
||||
else {
|
||||
var source = (sourceNode as ValueNode)?.Value as string;
|
||||
|
@ -67,8 +63,8 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
throw new XamlParseException($"Resource '{source}' not found.", node);
|
||||
|
||||
yield return Create(Ldtoken, module.ImportReference(((ILRootNode)rootNode).TypeReference));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", paramCount: 1, predicate: md => md.IsStatic));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System.Reflection", "IntrospectionExtensions"), methodName: "GetTypeInfo", paramCount: 1, predicate: md => md.IsStatic));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System.Reflection", "IntrospectionExtensions"), methodName: "GetTypeInfo", parameterTypes: new[] { ("mscorlib", "System", "Type") }, isStatic: true));
|
||||
yield return Create(Callvirt, module.ImportPropertyGetterReference(("mscorlib", "System.Reflection", "TypeInfo"), propertyName: "Assembly", flatten: true));
|
||||
|
||||
yield return Create(Ldstr, resourceId); //resourceId
|
||||
|
@ -78,8 +74,8 @@ namespace Xamarin.Forms.Core.XamlC
|
|||
|
||||
yield return Create(Call, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms.StyleSheets", "StyleSheet"),
|
||||
methodName: "FromAssemblyResource",
|
||||
paramCount: 3,
|
||||
predicate: md => md.IsStatic));
|
||||
parameterTypes: new[] { ("mscorlib", "System.Reflection", "Assembly"), ("mscorlib", "System", "String"), ("System.Xml.ReaderWriter", "System.Xml", "IXmlLineInfo") },
|
||||
isStatic: true));
|
||||
}
|
||||
|
||||
//the variable is of type `object`. fix that
|
||||
|
|
|
@ -437,22 +437,24 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
// IL_0016: pop
|
||||
yield return Create(Ldstr, valueString);
|
||||
yield return Create(Ldc_I4, 0x6f); //NumberStyles.Number
|
||||
var getInvariant = module.ImportPropertyGetterReference(("mscorlib", "System.Globalization", "CultureInfo"),
|
||||
propertyName: "InvariantCulture");
|
||||
yield return Create(Call, getInvariant);
|
||||
yield return Create(Call, module.ImportPropertyGetterReference(("mscorlib", "System.Globalization", "CultureInfo"),
|
||||
propertyName: "InvariantCulture",
|
||||
isStatic: true));
|
||||
yield return Create(Ldloca, vardef);
|
||||
var tryParse = module.ImportMethodReference(("mscorlib", "System", "Decimal"),
|
||||
methodName: "TryParse",
|
||||
paramCount: 4);
|
||||
yield return Create(Call, tryParse);
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Decimal"),
|
||||
methodName: "TryParse",
|
||||
parameterTypes: new[] {
|
||||
("mscorlib", "System", "String"),
|
||||
("mscorlib", "System.Globalization", "NumberStyles"),
|
||||
("mscorlib", "System", "IFormatProvider"),
|
||||
("mscorlib", "System", "Decimal"),
|
||||
},
|
||||
isStatic: true));
|
||||
yield return Create(Pop);
|
||||
yield return Create(Ldloc, vardef);
|
||||
} else {
|
||||
yield return Create(Ldc_I4_0);
|
||||
var decimalctor = module.ImportCtorReference(("mscorlib", "System", "Decimal"),
|
||||
paramCount: 1,
|
||||
predicate: md => md.Parameters[0].ParameterType.FullName == "System.Int32");
|
||||
yield return Create(Newobj, decimalctor);
|
||||
yield return Create(Newobj, module.ImportCtorReference(("mscorlib", "System", "Decimal"), parameterTypes: new[] { ("mscorlib", "System", "Int32") }));
|
||||
}
|
||||
break;
|
||||
case "System.Single":
|
||||
|
@ -473,23 +475,22 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
Context.Body.Variables.Add(vardef);
|
||||
//Use an extra temp var so we can push the value to the stack, just like other cases
|
||||
yield return Create(Ldstr, valueString);
|
||||
var getInvariant = module.ImportPropertyGetterReference(("mscorlib", "System.Globalization", "CultureInfo"),
|
||||
propertyName: "InvariantCulture");
|
||||
yield return Create(Call, getInvariant);
|
||||
yield return Create(Call, module.ImportPropertyGetterReference(("mscorlib", "System.Globalization", "CultureInfo"),
|
||||
propertyName: "InvariantCulture", isStatic: true));
|
||||
yield return Create(Ldloca, vardef);
|
||||
var tryParse = module.ImportMethodReference(("mscorlib", "System", "TimeSpan"),
|
||||
methodName: "TryParse",
|
||||
paramCount: 3);
|
||||
|
||||
yield return Create(Call, tryParse);
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "TimeSpan"),
|
||||
methodName: "TryParse",
|
||||
parameterTypes: new[] {
|
||||
("mscorlib", "System", "String"),
|
||||
("mscorlib", "System", "IFormatProvider"),
|
||||
("mscorlib", "System", "TimeSpan"),
|
||||
},
|
||||
isStatic: true));
|
||||
yield return Create(Pop);
|
||||
yield return Create(Ldloc, vardef);
|
||||
} else {
|
||||
yield return Create(Ldc_I8, 0L);
|
||||
var timespanctor = module.ImportCtorReference(("mscorlib", "System", "TimeSpan"),
|
||||
paramCount: 1,
|
||||
predicate: md => md.Parameters[0].ParameterType.FullName == "System.Int64");
|
||||
yield return Create(Newobj, timespanctor);
|
||||
yield return Create(Newobj, module.ImportCtorReference(("mscorlib", "System", "TimeSpan"), parameterTypes: new[] { ("mscorlib", "System", "Int64") }));
|
||||
}
|
||||
break;
|
||||
case "System.Uri":
|
||||
|
@ -500,17 +501,21 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
yield return Create(Ldstr, valueString);
|
||||
yield return Create(Ldc_I4, (int)UriKind.RelativeOrAbsolute);
|
||||
yield return Create(Ldloca, vardef);
|
||||
var tryCreate = module.ImportMethodReference(("System", "System", "Uri"),
|
||||
methodName: "TryCreate",
|
||||
paramCount: 3);
|
||||
yield return Create(Call, tryCreate);
|
||||
yield return Create(Call, module.ImportMethodReference(("System", "System", "Uri"),
|
||||
methodName: "TryCreate",
|
||||
parameterTypes: new[] {
|
||||
("mscorlib", "System", "String"),
|
||||
("System", "System", "UriKind"),
|
||||
("System", "System", "Uri"),
|
||||
},
|
||||
isStatic: true));
|
||||
yield return Create(Pop);
|
||||
yield return Create(Ldloc, vardef);
|
||||
} else
|
||||
yield return Create(Ldnull);
|
||||
break;
|
||||
default:
|
||||
var defaultCtor = module.ImportCtorReference(typedef, paramCount: 0);
|
||||
var defaultCtor = module.ImportCtorReference(typedef, parameterTypes: null);
|
||||
if (defaultCtor != null)
|
||||
yield return Create(Newobj, defaultCtor);
|
||||
else {
|
||||
|
|
|
@ -8,32 +8,35 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
{
|
||||
static class ModuleDefinitionExtensions
|
||||
{
|
||||
public static TypeReference ImportReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, (string assemblyName, string clrNamespace, string typeName)[] classArguments = null)
|
||||
static Dictionary<(ModuleDefinition module, string typeKey), TypeReference> TypeRefCache = new Dictionary<(ModuleDefinition module, string typeKey), TypeReference>();
|
||||
public static TypeReference ImportReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type)
|
||||
{
|
||||
var typeRef = module.ImportReference(module.GetTypeDefinition(type));
|
||||
if (classArguments is null)
|
||||
return typeRef;
|
||||
return module.ImportReference(typeRef.MakeGenericInstanceType(classArguments.Select(gp => module.GetTypeDefinition((gp.assemblyName, gp.clrNamespace, gp.typeName))).ToArray()));
|
||||
var typeKey = type.ToString();
|
||||
if (!TypeRefCache.TryGetValue((module, typeKey), out var typeRef))
|
||||
TypeRefCache.Add((module, typeKey), typeRef = module.ImportReference(module.GetTypeDefinition(type)));
|
||||
return typeRef;
|
||||
}
|
||||
|
||||
public static TypeReference ImportReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, (string assemblyName, string clrNamespace, string typeName)[] classArguments)
|
||||
{
|
||||
var typeKey = $"{type}<{string.Join(",",classArguments)}>";
|
||||
if (!TypeRefCache.TryGetValue((module, typeKey), out var typeRef))
|
||||
TypeRefCache.Add((module, typeKey), typeRef = module.ImportReference(module.ImportReference(type).MakeGenericInstanceType(classArguments.Select(gp => module.GetTypeDefinition((gp.assemblyName, gp.clrNamespace, gp.typeName))).ToArray())));
|
||||
return typeRef;
|
||||
}
|
||||
|
||||
public static TypeReference ImportArrayReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type)
|
||||
{
|
||||
var typeRef = module.ImportReference(type);
|
||||
if (typeRef is null)
|
||||
return null;
|
||||
return module.ImportReference(typeRef.MakeArrayType());
|
||||
var typeKey = "${type}[]";
|
||||
if (!TypeRefCache.TryGetValue((module, typeKey), out var typeRef))
|
||||
TypeRefCache.Add((module, typeKey), typeRef = module.ImportReference(module.ImportReference(type).MakeArrayType()));
|
||||
return typeRef;
|
||||
}
|
||||
|
||||
public static MethodReference ImportCtorReference(this ModuleDefinition module, TypeReference type, int paramCount, TypeReference[] classArguments = null, Func<MethodDefinition, bool> predicate = null)
|
||||
static Dictionary<(ModuleDefinition module, string methodRefKey), MethodReference> MethodRefCache = new Dictionary<(ModuleDefinition module, string methodRefKey), MethodReference>();
|
||||
static MethodReference ImportCtorReference(this ModuleDefinition module, TypeReference type, TypeReference[] classArguments, Func<MethodDefinition, bool> predicate)
|
||||
{
|
||||
var ctor = module
|
||||
.ImportReference(type)
|
||||
.ResolveCached()
|
||||
.Methods
|
||||
.FirstOrDefault(md =>
|
||||
md.IsConstructor
|
||||
&& md.Parameters.Count == paramCount
|
||||
&& (predicate?.Invoke(md) ?? true));
|
||||
var ctor = module.ImportReference(type).ResolveCached().Methods.FirstOrDefault(md => !md.IsPrivate && !md.IsStatic && md.IsConstructor && (predicate?.Invoke(md) ?? true));
|
||||
if (ctor is null)
|
||||
return null;
|
||||
var ctorRef = module.ImportReference(ctor);
|
||||
|
@ -42,22 +45,90 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
return module.ImportReference(ctorRef.ResolveGenericParameters(type.MakeGenericInstanceType(classArguments), module));
|
||||
}
|
||||
|
||||
public static MethodReference ImportCtorReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, int paramCount, (string assemblyName, string clrNamespace, string typeName)[] classArguments, Func<MethodDefinition, bool> predicate = null)
|
||||
public static MethodReference ImportCtorReference(this ModuleDefinition module, TypeReference type, TypeReference[] parameterTypes)
|
||||
{
|
||||
return module.ImportCtorReference(module.GetTypeDefinition(type), paramCount, classArguments?.Select(gp => module.GetTypeDefinition((gp.assemblyName, gp.clrNamespace, gp.typeName))).ToArray(), predicate);
|
||||
var ctorKey = $"{type}.ctor({(parameterTypes == null ? "" : string.Join(",", parameterTypes.Select(tr => (tr.Scope.Name, tr.Namespace, tr.Name))))})";
|
||||
if (MethodRefCache.TryGetValue((module, ctorKey), out var ctorRef))
|
||||
return ctorRef;
|
||||
ctorRef = module.ImportCtorReference(type, classArguments: null, predicate: md => {
|
||||
if (md.Parameters.Count != (parameterTypes?.Length ?? 0))
|
||||
return false;
|
||||
for (var i = 0; i < md.Parameters.Count; i++)
|
||||
if (!TypeRefComparer.Default.Equals(md.Parameters[i].ParameterType, module.ImportReference(parameterTypes[i])))
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
MethodRefCache.Add((module, ctorKey), ctorRef);
|
||||
return ctorRef;
|
||||
}
|
||||
|
||||
public static MethodReference ImportCtorReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, int paramCount, TypeReference[] classArguments, Func<MethodDefinition, bool> predicate = null)
|
||||
public static MethodReference ImportCtorReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, int paramCount)
|
||||
{
|
||||
return module.ImportCtorReference(module.GetTypeDefinition(type), paramCount, classArguments, predicate);
|
||||
var ctorKey = $"{type}.ctor({(string.Join(",", Enumerable.Repeat("_", paramCount)))})";
|
||||
if (!MethodRefCache.TryGetValue((module, ctorKey), out var ctorRef))
|
||||
MethodRefCache.Add((module, ctorKey), ctorRef = module.ImportCtorReference(module.GetTypeDefinition(type), null, md => md.Parameters.Count == paramCount));
|
||||
return ctorRef;
|
||||
}
|
||||
|
||||
public static MethodReference ImportCtorReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, int paramCount, Func<MethodDefinition, bool> predicate = null)
|
||||
public static MethodReference ImportCtorReference(this ModuleDefinition module, TypeReference type, int paramCount)
|
||||
{
|
||||
return module.ImportCtorReference(module.GetTypeDefinition(type), paramCount, null, predicate);
|
||||
var ctorKey = $"{type}.ctor({(string.Join(",", Enumerable.Repeat("_", paramCount)))})";
|
||||
if (!MethodRefCache.TryGetValue((module, ctorKey), out var ctorRef))
|
||||
MethodRefCache.Add((module, ctorKey), ctorRef = module.ImportCtorReference(type, null, md => md.Parameters.Count == paramCount));
|
||||
return ctorRef;
|
||||
}
|
||||
|
||||
public static MethodReference ImportPropertyGetterReference(this ModuleDefinition module, TypeReference type, string propertyName, Func<PropertyDefinition, bool> predicate = null, bool flatten = false)
|
||||
public static MethodReference ImportCtorReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, int paramCount, (string assemblyName, string clrNamespace, string typeName)[] classArguments)
|
||||
{
|
||||
var ctorKey = $"{type}<{(string.Join(",", classArguments))}>.ctor({(string.Join(",", Enumerable.Repeat("_", paramCount)))})";
|
||||
if (!MethodRefCache.TryGetValue((module, ctorKey), out var ctorRef))
|
||||
MethodRefCache.Add((module, ctorKey), ctorRef = module.ImportCtorReference(module.GetTypeDefinition(type), classArguments.Select(module.GetTypeDefinition).ToArray(), md=>md.Parameters.Count==paramCount));
|
||||
return ctorRef;
|
||||
}
|
||||
|
||||
public static MethodReference ImportCtorReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, int paramCount, TypeReference[] classArguments)
|
||||
{
|
||||
var ctorKey = $"{type}<{(string.Join(",", classArguments.Select(tr => (tr.Scope.Name, tr.Namespace, tr.Name))))}>.ctor({(string.Join(",", Enumerable.Repeat("_", paramCount)))})";
|
||||
if (!MethodRefCache.TryGetValue((module, ctorKey), out var ctorRef))
|
||||
MethodRefCache.Add((module, ctorKey), ctorRef = module.ImportCtorReference(module.GetTypeDefinition(type), classArguments, predicate: md => md.Parameters.Count == paramCount));
|
||||
return ctorRef;
|
||||
}
|
||||
|
||||
public static MethodReference ImportCtorReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, (string assemblyName, string clrNamespace, string typeName)[] parameterTypes, (string assemblyName, string clrNamespace, string typeName)[] classArguments)
|
||||
{
|
||||
var ctorKey = $"{type}<{(string.Join(",", classArguments))}>.ctor({(parameterTypes == null ? "" : string.Join(",", parameterTypes))})";
|
||||
if (MethodRefCache.TryGetValue((module, ctorKey), out var ctorRef))
|
||||
return ctorRef;
|
||||
ctorRef = module.ImportCtorReference(module.GetTypeDefinition(type), classArguments.Select(module.GetTypeDefinition).ToArray(), md => {
|
||||
if (md.Parameters.Count != (parameterTypes?.Length ?? 0))
|
||||
return false;
|
||||
for (var i = 0; i < md.Parameters.Count; i++)
|
||||
if (!TypeRefComparer.Default.Equals(md.Parameters[i].ParameterType, module.ImportReference(parameterTypes[i])))
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
MethodRefCache.Add((module, ctorKey), ctorRef);
|
||||
return ctorRef;
|
||||
}
|
||||
|
||||
public static MethodReference ImportCtorReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, (string assemblyName, string clrNamespace, string typeName)[] parameterTypes)
|
||||
{
|
||||
var ctorKey = $"{type}.ctor({(parameterTypes == null ? "" : string.Join(",", parameterTypes))})";
|
||||
if (MethodRefCache.TryGetValue((module, ctorKey), out var ctorRef))
|
||||
return ctorRef;
|
||||
ctorRef = module.ImportCtorReference(module.GetTypeDefinition(type), classArguments: null, predicate: md => {
|
||||
if (md.Parameters.Count != (parameterTypes?.Length ?? 0))
|
||||
return false;
|
||||
for (var i = 0; i < md.Parameters.Count; i++)
|
||||
if (!TypeRefComparer.Default.Equals(md.Parameters[i].ParameterType, module.ImportReference(parameterTypes[i])))
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
MethodRefCache.Add((module, ctorKey), ctorRef);
|
||||
return ctorRef;
|
||||
}
|
||||
|
||||
static MethodReference ImportPropertyGetterReference(this ModuleDefinition module, TypeReference type, string propertyName, Func<PropertyDefinition, bool> predicate = null, bool flatten = false)
|
||||
{
|
||||
var properties = module.ImportReference(type).Resolve().Properties;
|
||||
var getter = module
|
||||
|
@ -66,17 +137,21 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
.Properties(flatten)
|
||||
.FirstOrDefault(pd =>
|
||||
pd.Name == propertyName
|
||||
&& !pd.GetMethod.IsPrivate
|
||||
&& (predicate?.Invoke(pd) ?? true))
|
||||
?.GetMethod;
|
||||
return getter == null ? null : module.ImportReference(getter);
|
||||
}
|
||||
|
||||
public static MethodReference ImportPropertyGetterReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, string propertyName, Func<PropertyDefinition, bool> predicate = null, bool flatten = false)
|
||||
public static MethodReference ImportPropertyGetterReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, string propertyName, bool isStatic = false, bool flatten = false)
|
||||
{
|
||||
return module.ImportPropertyGetterReference(module.GetTypeDefinition(type), propertyName, predicate, flatten);
|
||||
var getterKey = $"{(isStatic ? "static " : "")}{type}.get_{propertyName}{(flatten ? "*" : "")}";
|
||||
if (!MethodRefCache.TryGetValue((module, getterKey), out var methodReference))
|
||||
MethodRefCache.Add((module, getterKey), methodReference = module.ImportPropertyGetterReference(module.GetTypeDefinition(type), propertyName, pd => pd.GetMethod.IsStatic == isStatic, flatten));
|
||||
return methodReference;
|
||||
}
|
||||
|
||||
public static MethodReference ImportPropertySetterReference(this ModuleDefinition module, TypeReference type, string propertyName, Func<PropertyDefinition, bool> predicate = null)
|
||||
static MethodReference ImportPropertySetterReference(this ModuleDefinition module, TypeReference type, string propertyName, Func<PropertyDefinition, bool> predicate = null)
|
||||
{
|
||||
var setter = module
|
||||
.ImportReference(type)
|
||||
|
@ -84,34 +159,21 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
.Properties
|
||||
.FirstOrDefault(pd =>
|
||||
pd.Name == propertyName
|
||||
&& !pd.SetMethod.IsPrivate
|
||||
&& (predicate?.Invoke(pd) ?? true))
|
||||
?.SetMethod;
|
||||
return setter == null ? null : module.ImportReference(setter);
|
||||
}
|
||||
|
||||
public static MethodReference ImportPropertySetterReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, string propertyName, Func<PropertyDefinition, bool> predicate = null)
|
||||
public static MethodReference ImportPropertySetterReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, string propertyName, bool isStatic = false)
|
||||
{
|
||||
return module.ImportPropertySetterReference(module.GetTypeDefinition(type), propertyName, predicate);
|
||||
var setterKey = $"{(isStatic ? "static " : "")}{type}.set{propertyName}";
|
||||
if (!MethodRefCache.TryGetValue((module, setterKey), out var methodReference))
|
||||
MethodRefCache.Add((module,setterKey), methodReference = module.ImportPropertySetterReference(module.GetTypeDefinition(type), propertyName, pd => pd.SetMethod.IsStatic == isStatic));
|
||||
return methodReference;
|
||||
}
|
||||
|
||||
public static FieldReference ImportFieldReference(this ModuleDefinition module, TypeReference type, string fieldName, Func<FieldDefinition, bool> predicate = null)
|
||||
{
|
||||
var field = module
|
||||
.ImportReference(type)
|
||||
.ResolveCached()
|
||||
.Fields
|
||||
.FirstOrDefault(fd =>
|
||||
fd.Name == fieldName
|
||||
&& (predicate?.Invoke(fd) ?? true));
|
||||
return field == null ? null : module.ImportReference(field);
|
||||
}
|
||||
|
||||
public static FieldReference ImportFieldReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, string fieldName, Func<FieldDefinition, bool> predicate = null)
|
||||
{
|
||||
return module.ImportFieldReference(module.GetTypeDefinition(type), fieldName: fieldName, predicate: predicate);
|
||||
}
|
||||
|
||||
public static MethodReference ImportMethodReference(this ModuleDefinition module, TypeReference type, string methodName, int paramCount, Func<MethodDefinition, bool> predicate = null, TypeReference[] classArguments = null)
|
||||
static MethodReference ImportMethodReference(this ModuleDefinition module, TypeReference type, string methodName, Func<MethodDefinition, bool> predicate = null, TypeReference[] classArguments = null)
|
||||
{
|
||||
var method = module
|
||||
.ImportReference(type)
|
||||
|
@ -119,8 +181,8 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
.Methods
|
||||
.FirstOrDefault(md =>
|
||||
!md.IsConstructor
|
||||
&& !md.IsPrivate
|
||||
&& md.Name == methodName
|
||||
&& md.Parameters.Count == paramCount
|
||||
&& (predicate?.Invoke(md) ?? true));
|
||||
if (method is null)
|
||||
return null;
|
||||
|
@ -132,11 +194,74 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
|
||||
public static MethodReference ImportMethodReference(this ModuleDefinition module,
|
||||
(string assemblyName, string clrNamespace, string typeName) type,
|
||||
string methodName, int paramCount, Func<MethodDefinition, bool> predicate = null,
|
||||
(string assemblyName, string clrNamespace, string typeName)[] classArguments = null)
|
||||
string methodName,
|
||||
(string assemblyName, string clrNamespace, string typeName)[] parameterTypes,
|
||||
(string assemblyName, string clrNamespace, string typeName)[] classArguments = null,
|
||||
bool isStatic = false)
|
||||
{
|
||||
return module.ImportMethodReference(module.GetTypeDefinition(type), methodName, paramCount, predicate,
|
||||
classArguments?.Select(gp => module.GetTypeDefinition((gp.assemblyName, gp.clrNamespace, gp.typeName))).ToArray());
|
||||
var methodKey = $"{(isStatic ? "static " : "")}{type}<{(classArguments == null ? "" : string.Join(",", classArguments))}>.({(parameterTypes == null ? "" : string.Join(",", parameterTypes))})";
|
||||
if (MethodRefCache.TryGetValue((module, methodKey), out var methodReference))
|
||||
return methodReference;
|
||||
methodReference = module.ImportMethodReference(module.GetTypeDefinition(type),
|
||||
methodName: methodName,
|
||||
predicate: md => {
|
||||
if (md.IsStatic != isStatic)
|
||||
return false;
|
||||
if (md.Parameters.Count != (parameterTypes?.Length ?? 0))
|
||||
return false;
|
||||
for (var i = 0; i < md.Parameters.Count; i++)
|
||||
if (!TypeRefComparer.Default.Equals(md.Parameters[i].ParameterType, module.ImportReference(parameterTypes[i])))
|
||||
return false;
|
||||
return true;
|
||||
},
|
||||
classArguments: classArguments?.Select(gp => module.GetTypeDefinition((gp.assemblyName, gp.clrNamespace, gp.typeName))).ToArray());
|
||||
MethodRefCache.Add((module, methodKey), methodReference);
|
||||
return methodReference;
|
||||
}
|
||||
|
||||
public static MethodReference ImportMethodReference(this ModuleDefinition module,
|
||||
(string assemblyName, string clrNamespace, string typeName) type,
|
||||
string methodName,
|
||||
int paramCount,
|
||||
(string assemblyName, string clrNamespace, string typeName)[] classArguments = null,
|
||||
bool isStatic = false)
|
||||
{
|
||||
var methodKey = $"{(isStatic ? "static " : "")}{type}<{(classArguments == null ? "" : string.Join(",", classArguments))}>.({(string.Join(",", Enumerable.Repeat("_", paramCount)))})";
|
||||
if (MethodRefCache.TryGetValue((module, methodKey), out var methodReference))
|
||||
return methodReference;
|
||||
methodReference = module.ImportMethodReference(module.GetTypeDefinition(type),
|
||||
methodName: methodName,
|
||||
predicate: md => {
|
||||
if (md.IsStatic != isStatic)
|
||||
return false;
|
||||
if (md.Parameters.Count != paramCount)
|
||||
return false;
|
||||
return true;
|
||||
},
|
||||
classArguments: classArguments?.Select(gp => module.GetTypeDefinition((gp.assemblyName, gp.clrNamespace, gp.typeName))).ToArray());
|
||||
MethodRefCache.Add((module, methodKey), methodReference);
|
||||
return methodReference;
|
||||
}
|
||||
|
||||
static Dictionary<(ModuleDefinition module, string fieldRefKey), FieldReference> FieldRefCache = new Dictionary<(ModuleDefinition module, string fieldRefKey), FieldReference>();
|
||||
static FieldReference ImportFieldReference(this ModuleDefinition module, TypeReference type, string fieldName, Func<FieldDefinition, bool> predicate = null)
|
||||
{
|
||||
var field = module
|
||||
.ImportReference(type)
|
||||
.ResolveCached()
|
||||
.Fields
|
||||
.FirstOrDefault(fd =>
|
||||
fd.Name == fieldName
|
||||
&& (predicate?.Invoke(fd) ?? true));
|
||||
return field == null ? null : module.ImportReference(field);
|
||||
}
|
||||
|
||||
public static FieldReference ImportFieldReference(this ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, string fieldName, bool isStatic = false)
|
||||
{
|
||||
var fieldKey = $"{(isStatic ? "static " : "")}{type}.{fieldName}";
|
||||
if (!FieldRefCache.TryGetValue((module, fieldKey), out var fieldReference))
|
||||
FieldRefCache.Add((module, fieldKey), fieldReference = module.ImportFieldReference(module.GetTypeDefinition(type), fieldName: fieldName, predicate: fd => fd.IsStatic == isStatic));
|
||||
return fieldReference;
|
||||
}
|
||||
|
||||
static Dictionary<(ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName)), TypeDefinition> typeDefCache
|
||||
|
|
|
@ -116,7 +116,7 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
if (typeConverter != null)
|
||||
{
|
||||
var isExtendedConverter = typeConverter.ImplementsInterface(module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms", "IExtendedTypeConverter")));
|
||||
var typeConverterCtorRef = module.ImportCtorReference(typeConverter, paramCount: 0, predicate: md => !md.IsStatic);
|
||||
var typeConverterCtorRef = module.ImportCtorReference(typeConverter, paramCount: 0);
|
||||
var convertFromInvariantStringDefinition = isExtendedConverter
|
||||
? module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms", "IExtendedTypeConverter"))
|
||||
.ResolveCached()
|
||||
|
@ -190,17 +190,13 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
} else if (targetTypeRef.FullName == "System.TimeSpan") {
|
||||
var ts = TimeSpan.Parse(str, CultureInfo.InvariantCulture);
|
||||
var ticks = ts.Ticks;
|
||||
var timeSpanCtorRef = module.ImportCtorReference(("mscorlib", "System", "TimeSpan"), paramCount: 1);
|
||||
|
||||
yield return Instruction.Create(OpCodes.Ldc_I8, ticks);
|
||||
yield return Instruction.Create(OpCodes.Newobj, timeSpanCtorRef);
|
||||
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(("mscorlib", "System", "TimeSpan"), parameterTypes: new[] { ("mscorlib", "System", "Int64") }));
|
||||
} else if (targetTypeRef.FullName == "System.DateTime") {
|
||||
var dt = DateTime.Parse(str, CultureInfo.InvariantCulture);
|
||||
var ticks = dt.Ticks;
|
||||
var dateTimeCtorRef = module.ImportCtorReference(("mscorlib", "System", "DateTime"), paramCount: 1);
|
||||
|
||||
yield return Instruction.Create(OpCodes.Ldc_I8, ticks);
|
||||
yield return Instruction.Create(OpCodes.Newobj, dateTimeCtorRef);
|
||||
yield return Instruction.Create(OpCodes.Newobj, module.ImportCtorReference(("mscorlib", "System", "DateTime"), parameterTypes: new[] { ("mscorlib", "System", "Int64") }));
|
||||
} else if (targetTypeRef.FullName == "System.String" && str.StartsWith("{}", StringComparison.Ordinal))
|
||||
yield return Instruction.Create(OpCodes.Ldstr, str.Substring(2));
|
||||
else if (targetTypeRef.FullName == "System.String")
|
||||
|
@ -219,35 +215,36 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
// IL_000f: ldloca.s 0
|
||||
// IL_0011: call bool valuetype [mscorlib]System.Decimal::TryParse(string, valuetype [mscorlib]System.Globalization.NumberStyles, class [mscorlib]System.IFormatProvider, [out] valuetype [mscorlib]System.Decimal&)
|
||||
// IL_0016: pop
|
||||
yield return Instruction.Create(OpCodes.Ldstr, str);
|
||||
yield return Instruction.Create(OpCodes.Ldc_I4, 0x6f); //NumberStyles.Number
|
||||
var getInvariant = module.ImportPropertyGetterReference(("mscorlib", "System.Globalization", "CultureInfo"),
|
||||
propertyName: "InvariantCulture");
|
||||
yield return Instruction.Create(OpCodes.Call, getInvariant);
|
||||
yield return Instruction.Create(OpCodes.Ldloca, vardef);
|
||||
var tryParse = module.ImportMethodReference(("mscorlib", "System", "Decimal"),
|
||||
methodName: "TryParse",
|
||||
paramCount: 4);
|
||||
yield return Instruction.Create(OpCodes.Call, tryParse);
|
||||
yield return Instruction.Create(OpCodes.Pop);
|
||||
yield return Instruction.Create(OpCodes.Ldloc, vardef);
|
||||
yield return Create(Ldstr, str);
|
||||
yield return Create(Ldc_I4, 0x6f); //NumberStyles.Number
|
||||
yield return Create(Call, module.ImportPropertyGetterReference(("mscorlib", "System.Globalization", "CultureInfo"),
|
||||
propertyName: "InvariantCulture", isStatic: true));
|
||||
yield return Create(Ldloca, vardef);
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Decimal"),
|
||||
methodName: "TryParse",
|
||||
parameterTypes: new[] {
|
||||
("mscorlib", "System", "String"),
|
||||
("mscorlib", "System.Globalization", "NumberStyles"),
|
||||
("mscorlib", "System", "IFormatProvider"),
|
||||
("mscorlib", "System", "Decimal"),
|
||||
},
|
||||
isStatic: true));
|
||||
yield return Create(Pop);
|
||||
yield return Create(Ldloc, vardef);
|
||||
} else {
|
||||
yield return Instruction.Create(OpCodes.Ldc_I4_0);
|
||||
var decimalctor = module.ImportCtorReference(("mscorlib", "System", "Decimal"),
|
||||
paramCount: 1,
|
||||
predicate: md => md.Parameters[0].ParameterType.FullName == "System.Int32");
|
||||
yield return Instruction.Create(OpCodes.Newobj, decimalctor);
|
||||
yield return Create(Ldc_I4_0);
|
||||
yield return Create(Newobj, module.ImportCtorReference(("mscorlib", "System", "Decimal"), parameterTypes: new[] { ("mscorlib", "System", "Int32") }));
|
||||
}
|
||||
} else if (implicitOperator != null) {
|
||||
yield return Instruction.Create(OpCodes.Ldstr, node.Value as string);
|
||||
yield return Instruction.Create(OpCodes.Call, module.ImportReference(implicitOperator));
|
||||
yield return Create(Ldstr, node.Value as string);
|
||||
yield return Create(Call, module.ImportReference(implicitOperator));
|
||||
} else
|
||||
yield return Instruction.Create(OpCodes.Ldnull);
|
||||
yield return Create(Ldnull);
|
||||
|
||||
if (isNullable)
|
||||
yield return Instruction.Create(OpCodes.Newobj, module.ImportReference(nullableCtor));
|
||||
yield return Create(Newobj, module.ImportReference(nullableCtor));
|
||||
if (originalTypeRef.IsValueType && boxValueTypes)
|
||||
yield return Instruction.Create(OpCodes.Box, module.ImportReference(originalTypeRef));
|
||||
yield return Create(Box, module.ImportReference(originalTypeRef));
|
||||
}
|
||||
|
||||
static Instruction PushParsedEnum(TypeReference enumRef, string value, IXmlLineInfo lineInfo)
|
||||
|
@ -346,10 +343,13 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
if (xmlLineInfo.HasLineInfo()) {
|
||||
yield return Create(Ldc_I4, xmlLineInfo.LineNumber);
|
||||
yield return Create(Ldc_I4, xmlLineInfo.LinePosition);
|
||||
ctor = module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "XmlLineInfo"), paramCount: 2);
|
||||
ctor = module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "XmlLineInfo"), parameterTypes: new[] {
|
||||
("mscorlib", "System", "Int32"),
|
||||
("mscorlib", "System", "Int32"),
|
||||
});
|
||||
}
|
||||
else
|
||||
ctor = module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "XmlLineInfo"), paramCount: 0);
|
||||
ctor = module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "XmlLineInfo"), parameterTypes: null);
|
||||
yield return Create(Newobj, ctor);
|
||||
}
|
||||
|
||||
|
@ -406,17 +406,22 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
//Copy original array to final
|
||||
if (context.ParentContextValues != null)
|
||||
{
|
||||
yield return Instruction.Create(OpCodes.Ldarg_0);
|
||||
yield return Instruction.Create(OpCodes.Ldfld, context.ParentContextValues); //sourceArray
|
||||
yield return Instruction.Create(OpCodes.Ldc_I4_0); //sourceIndex
|
||||
yield return Instruction.Create(OpCodes.Ldloc, finalArray); //destinationArray
|
||||
yield return Instruction.Create(OpCodes.Ldc_I4, nodes.Count); //destinationIndex
|
||||
yield return Instruction.Create(OpCodes.Ldloc, parentObjectLength); //length
|
||||
var arrayCopy = module.ImportMethodReference(("mscorlib", "System", "Array"),
|
||||
methodName: "Copy",
|
||||
paramCount: 5,
|
||||
predicate: md => md.Parameters[1].ParameterType.FullName == "System.Int32");
|
||||
yield return Instruction.Create(OpCodes.Call, arrayCopy);
|
||||
yield return Create(Ldarg_0);
|
||||
yield return Create(Ldfld, context.ParentContextValues); //sourceArray
|
||||
yield return Create(Ldc_I4_0); //sourceIndex
|
||||
yield return Create(Ldloc, finalArray); //destinationArray
|
||||
yield return Create(Ldc_I4, nodes.Count); //destinationIndex
|
||||
yield return Create(Ldloc, parentObjectLength); //length
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Array"),
|
||||
methodName: "Copy",
|
||||
parameterTypes: new[] {
|
||||
("mscorlib", "System", "Array"),
|
||||
("mscorlib", "System", "Int32"),
|
||||
("mscorlib", "System", "Array"),
|
||||
("mscorlib", "System", "Int32"),
|
||||
("mscorlib", "System", "Int32"),
|
||||
},
|
||||
isStatic: true));
|
||||
}
|
||||
|
||||
//Add nodes to array
|
||||
|
@ -444,9 +449,15 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
}
|
||||
if (propertyRef != null) {
|
||||
yield return Create(Ldtoken, module.ImportReference(declaringTypeReference ?? propertyRef.DeclaringType));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", paramCount: 1, predicate: md => md.IsStatic));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
|
||||
yield return Create(Ldstr, propertyRef.Name);
|
||||
yield return Create(Call, module.ImportMethodReference(("System.Reflection.Extensions", "System.Reflection", "RuntimeReflectionExtensions"), methodName: "GetRuntimeProperty", paramCount: 2));
|
||||
yield return Create(Call, module.ImportMethodReference(("System.Reflection.Extensions", "System.Reflection", "RuntimeReflectionExtensions"),
|
||||
methodName: "GetRuntimeProperty",
|
||||
parameterTypes: new[]{
|
||||
("mscorlib", "System", "Type"),
|
||||
("mscorlib", "System", "String"),
|
||||
},
|
||||
isStatic: true));
|
||||
yield break;
|
||||
}
|
||||
yield return Create(Ldnull);
|
||||
|
@ -462,17 +473,21 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
yield break;
|
||||
#endif
|
||||
|
||||
var addService = module.ImportMethodReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XamlServiceProvider"), methodName: "Add", paramCount: 2);
|
||||
var getTypeFromHandle = module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", paramCount: 1, predicate: md => md.IsStatic);
|
||||
var addService = module.ImportMethodReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XamlServiceProvider"),
|
||||
methodName: "Add",
|
||||
parameterTypes: new[] {
|
||||
("mscorlib", "System", "Type"),
|
||||
("mscorlib", "System", "Object"),
|
||||
});
|
||||
|
||||
yield return Create(Newobj, module.ImportCtorReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XamlServiceProvider"), paramCount: 0));
|
||||
yield return Create(Newobj, module.ImportCtorReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XamlServiceProvider"), parameterTypes: null));
|
||||
|
||||
//Add a SimpleValueTargetProvider
|
||||
var pushParentIl = node.PushParentObjectsArray(context).ToList();
|
||||
if (pushParentIl[pushParentIl.Count - 1].OpCode != Ldnull) {
|
||||
yield return Create(Dup); //Keep the serviceProvider on the stack
|
||||
yield return Create(Ldtoken, module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "IProvideValueTarget")));
|
||||
yield return Create(Call, getTypeFromHandle);
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
|
||||
|
||||
foreach (var instruction in pushParentIl)
|
||||
yield return instruction;
|
||||
|
@ -486,10 +501,10 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
|
||||
//Add a NamescopeProvider
|
||||
if (context.Scopes.ContainsKey(node)) {
|
||||
yield return Create(Dup); //Dupicate the serviceProvider
|
||||
yield return Create(Dup); //Duplicate the serviceProvider
|
||||
yield return Create(Ldtoken, module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml.Internals", "INameScopeProvider")));
|
||||
yield return Create(Call, getTypeFromHandle);
|
||||
yield return Create(Newobj, module.ImportCtorReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "NameScopeProvider"), paramCount: 0));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
|
||||
yield return Create(Newobj, module.ImportCtorReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "NameScopeProvider"), parameterTypes: null));
|
||||
yield return Create(Dup); //Duplicate the namescopeProvider
|
||||
yield return Create(Ldloc, context.Scopes[node].Item1);
|
||||
yield return Create(Callvirt, module.ImportPropertySetterReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "NameScopeProvider"), propertyName: "NameScope"));
|
||||
|
@ -498,31 +513,36 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
|
||||
//Add a XamlTypeResolver
|
||||
if (node.NamespaceResolver != null) {
|
||||
yield return Create(Dup); //Dupicate the serviceProvider
|
||||
yield return Create(Dup); //Duplicate the serviceProvider
|
||||
yield return Create(Ldtoken, module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "IXamlTypeResolver")));
|
||||
yield return Create(Call, getTypeFromHandle);
|
||||
yield return Create(Newobj, module.ImportCtorReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XmlNamespaceResolver"), paramCount: 0));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
|
||||
yield return Create(Newobj, module.ImportCtorReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XmlNamespaceResolver"), parameterTypes: null));
|
||||
foreach (var kvp in node.NamespaceResolver.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml)) {
|
||||
yield return Create(Dup); //dup the resolver
|
||||
yield return Create(Ldstr, kvp.Key);
|
||||
yield return Create(Ldstr, kvp.Value);
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XmlNamespaceResolver"), methodName: "Add", paramCount: 2));
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XmlNamespaceResolver"),
|
||||
methodName: "Add",
|
||||
parameterTypes: new[] {
|
||||
("mscorlib", "System", "String"),
|
||||
("mscorlib", "System", "String"),
|
||||
}));
|
||||
}
|
||||
yield return Create(Ldtoken, context.Body.Method.DeclaringType);
|
||||
yield return Create(Call, getTypeFromHandle);
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System.Reflection", "IntrospectionExtensions"), methodName: "GetTypeInfo", paramCount: 1, predicate: md => md.IsStatic));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System.Reflection", "IntrospectionExtensions"), methodName: "GetTypeInfo", parameterTypes: new[] { ("mscorlib", "System", "Type") }, isStatic: true));
|
||||
yield return Create(Callvirt, module.ImportPropertyGetterReference(("mscorlib", "System.Reflection", "TypeInfo"), propertyName: "Assembly", flatten: true));
|
||||
yield return Create(Newobj, module.ImportCtorReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XamlTypeResolver"), paramCount: 2));
|
||||
yield return Create(Callvirt, addService);
|
||||
}
|
||||
|
||||
if (node is IXmlLineInfo) {
|
||||
yield return Create(Dup); //Dupicate the serviceProvider
|
||||
yield return Create(Dup); //Duplicate the serviceProvider
|
||||
yield return Create(Ldtoken, module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "IXmlLineInfoProvider")));
|
||||
yield return Create(Call, getTypeFromHandle);
|
||||
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
|
||||
foreach (var instruction in node.PushXmlLineInfo(context))
|
||||
yield return instruction;
|
||||
yield return Create(Newobj, module.ImportCtorReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XmlLineInfoProvider"), paramCount: 1));
|
||||
yield return Create(Newobj, module.ImportCtorReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XmlLineInfoProvider"), parameterTypes: new[] { ("System.Xml.ReaderWriter", "System.Xml", "IXmlLineInfo") }));
|
||||
yield return Create(Callvirt, addService);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
var module = Context.Body.Method.Module;
|
||||
var vardef = new VariableDefinition(module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms.Internals", "NameScope")));
|
||||
Context.Body.Variables.Add(vardef);
|
||||
Context.IL.Emit(OpCodes.Newobj, module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms.Internals", "NameScope"), paramCount: 0));
|
||||
Context.IL.Emit(OpCodes.Newobj, module.ImportCtorReference(("Xamarin.Forms.Core", "Xamarin.Forms.Internals", "NameScope"), parameterTypes: null));
|
||||
Context.IL.Emit(OpCodes.Stloc, vardef);
|
||||
return vardef;
|
||||
}
|
||||
|
@ -114,8 +114,11 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
Context.IL.Emit(OpCodes.Ldloc, ns);
|
||||
Context.IL.Emit(OpCodes.Call, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms.Internals", "NameScope"),
|
||||
methodName: "SetNameScope",
|
||||
paramCount: 2,
|
||||
predicate: md => md.IsStatic));
|
||||
parameterTypes: new[] {
|
||||
("Xamarin.Forms.Core", "Xamarin.Forms", "BindableObject"),
|
||||
("Xamarin.Forms.Core", "Xamarin.Forms.Internals", "INameScope"),
|
||||
},
|
||||
isStatic: true));
|
||||
}
|
||||
|
||||
void RegisterName(string str, VariableDefinition namescopeVarDef, IList<string> namesInNamescope, VariableDefinition element, INode node)
|
||||
|
@ -130,7 +133,10 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
Context.IL.Emit(OpCodes.Ldloc, element);
|
||||
Context.IL.Emit(OpCodes.Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms.Internals", "INameScope"),
|
||||
methodName: "RegisterName",
|
||||
paramCount: 2));
|
||||
parameterTypes: new[] {
|
||||
("mscorlib", "System", "String"),
|
||||
("mscorlib", "System", "Object"),
|
||||
}));
|
||||
}
|
||||
|
||||
void SetStyleId(string str, VariableDefinition element)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
|
@ -301,14 +300,16 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
{
|
||||
var acceptEmptyServiceProvider = context.Variables[node].VariableType.GetCustomAttribute(module, ("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "AcceptEmptyServiceProviderAttribute")) != null;
|
||||
vardefref.VariableDefinition = new VariableDefinition(module.TypeSystem.Object);
|
||||
yield return Instruction.Create(OpCodes.Ldloc, context.Variables[node]);
|
||||
yield return Create(Ldloc, context.Variables[node]);
|
||||
if (acceptEmptyServiceProvider)
|
||||
yield return Instruction.Create(OpCodes.Ldnull);
|
||||
yield return Create(Ldnull);
|
||||
else
|
||||
foreach (var instruction in node.PushServiceProvider(context, bpRef, propertyRef, propertyDeclaringTypeRef))
|
||||
yield return instruction;
|
||||
yield return Instruction.Create(OpCodes.Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "IMarkupExtension"), methodName: "ProvideValue", paramCount: 1));
|
||||
yield return Instruction.Create(OpCodes.Stloc, vardefref.VariableDefinition);
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "IMarkupExtension"),
|
||||
methodName: "ProvideValue",
|
||||
parameterTypes: new[] { ("System.ComponentModel", "System", "IServiceProvider") }));
|
||||
yield return Create(Stloc, vardefref.VariableDefinition);
|
||||
}
|
||||
else if (context.Variables[node].VariableType.ImplementsInterface(module.ImportReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "IValueProvider"))))
|
||||
{
|
||||
|
@ -331,16 +332,16 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
}
|
||||
|
||||
vardefref.VariableDefinition = new VariableDefinition(module.TypeSystem.Object);
|
||||
yield return Instruction.Create(OpCodes.Ldloc, context.Variables[node]);
|
||||
yield return Create(Ldloc, context.Variables[node]);
|
||||
if (acceptEmptyServiceProvider)
|
||||
yield return Instruction.Create(OpCodes.Ldnull);
|
||||
yield return Create(Ldnull);
|
||||
else
|
||||
foreach (var instruction in node.PushServiceProvider(context, bpRef, propertyRef, propertyDeclaringTypeRef))
|
||||
yield return instruction;
|
||||
yield return Instruction.Create(OpCodes.Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "IValueProvider"),
|
||||
methodName: "ProvideValue",
|
||||
paramCount: 1));
|
||||
yield return Instruction.Create(OpCodes.Stloc, vardefref.VariableDefinition);
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml", "IValueProvider"),
|
||||
methodName: "ProvideValue",
|
||||
parameterTypes: new[] { ("System.ComponentModel", "System", "IServiceProvider") }));
|
||||
yield return Create(Stloc, vardefref.VariableDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -475,7 +476,7 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
new ParameterDefinition(tSourceRef)
|
||||
},
|
||||
CustomAttributes = {
|
||||
new CustomAttribute (module.ImportCtorReference(("mscorlib", "System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), paramCount: 0))
|
||||
new CustomAttribute (module.ImportCtorReference(("mscorlib", "System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), parameterTypes: null))
|
||||
}
|
||||
};
|
||||
getter.Body.InitLocals = true;
|
||||
|
@ -550,7 +551,7 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
new ParameterDefinition(tPropertyRef)
|
||||
},
|
||||
CustomAttributes = {
|
||||
new CustomAttribute (module.ImportCtorReference(("mscorlib", "System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), paramCount: 0))
|
||||
new CustomAttribute (module.ImportCtorReference(("mscorlib", "System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), parameterTypes: null))
|
||||
}
|
||||
};
|
||||
setter.Body.InitLocals = true;
|
||||
|
@ -652,7 +653,7 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
new ParameterDefinition(tSourceRef)
|
||||
},
|
||||
CustomAttributes = {
|
||||
new CustomAttribute (module.ImportCtorReference(("mscorlib", "System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), paramCount: 0))
|
||||
new CustomAttribute (module.ImportCtorReference(("mscorlib", "System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), parameterTypes: null))
|
||||
}
|
||||
};
|
||||
partGetter.Body.InitLocals = true;
|
||||
|
@ -893,7 +894,12 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
yield return Create(Ldsfld, bpRef);
|
||||
yield return Create(Ldloc, context.Variables[elementNode]);
|
||||
yield return Create(Callvirt, module.ImportPropertyGetterReference(("Xamarin.Forms.Core", "Xamarin.Forms.Internals", "DynamicResource"), propertyName: "Key"));
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms.Internals", "IDynamicResourceHandler"), methodName: "SetDynamicResource", paramCount: 2));
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms.Internals", "IDynamicResourceHandler"),
|
||||
methodName: "SetDynamicResource",
|
||||
parameterTypes: new[] {
|
||||
("Xamarin.Forms.Core", "Xamarin.Forms", "BindableProperty"),
|
||||
("mscorlib", "System", "String"),
|
||||
}));
|
||||
}
|
||||
|
||||
static bool CanSetBinding(FieldReference bpRef, INode valueNode, ILContext context)
|
||||
|
@ -929,7 +935,12 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
if (implicitOperator != null)
|
||||
// IL_000f: call !0 class [Xamarin.Forms.Core]Xamarin.Forms.OnPlatform`1<BindingBase>::op_Implicit(class [Xamarin.Forms.Core]Xamarin.Forms.OnPlatform`1<!0>)
|
||||
yield return Create(Call, module.ImportReference(implicitOperator));
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "BindableObject"), methodName: "SetBinding", paramCount: 2));
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "BindableObject"),
|
||||
methodName: "SetBinding",
|
||||
parameterTypes: new[] {
|
||||
("Xamarin.Forms.Core", "Xamarin.Forms", "BindableProperty"),
|
||||
("Xamarin.Forms.Core", "Xamarin.Forms", "BindingBase"),
|
||||
}));
|
||||
}
|
||||
|
||||
static bool CanSetValue(FieldReference bpRef, bool attached, INode node, IXmlLineInfo iXmlLineInfo, ILContext context)
|
||||
|
@ -1012,7 +1023,12 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
if (varType.IsValueType)
|
||||
yield return Create(Box, varType);
|
||||
}
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "BindableObject"), methodName: "SetValue", paramCount: 2));
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "BindableObject"),
|
||||
methodName: "SetValue",
|
||||
parameterTypes: new[] {
|
||||
("Xamarin.Forms.Core", "Xamarin.Forms", "BindableProperty"),
|
||||
("mscorlib", "System", "Object"),
|
||||
}));
|
||||
}
|
||||
|
||||
static IEnumerable<Instruction> GetValue(VariableDefinition parent, FieldReference bpRef, IXmlLineInfo iXmlLineInfo, ILContext context, out TypeReference propertyType)
|
||||
|
@ -1023,7 +1039,9 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
return new[] {
|
||||
Create(Ldloc, parent),
|
||||
Create(Ldsfld, bpRef),
|
||||
Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "BindableObject"), methodName: "GetValue", paramCount: 1)),
|
||||
Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "BindableObject"),
|
||||
methodName: "GetValue",
|
||||
parameterTypes: new[] { ("Xamarin.Forms.Core", "Xamarin.Forms", "BindableProperty")})),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1192,8 +1210,7 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
var module = context.Body.Method.Module;
|
||||
if (module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "ResourceDictionary"),
|
||||
methodName: "Add",
|
||||
paramCount: 1,
|
||||
predicate: md => TypeRefComparer.Default.Equals(md.Parameters[0].ParameterType, nodeTypeRef)) != null)
|
||||
parameterTypes: new[] { (nodeTypeRef.Scope.Name, nodeTypeRef.Namespace, nodeTypeRef.Name) }) != null)
|
||||
return true;
|
||||
|
||||
throw new XamlParseException("resources in ResourceDictionary require a x:Key attribute", lineInfo);
|
||||
|
@ -1245,15 +1262,19 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
if (varDef.VariableType.IsValueType)
|
||||
yield return Create(Box, module.ImportReference(varDef.VariableType));
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "ResourceDictionary"),
|
||||
methodName: "Add", paramCount: 2));
|
||||
methodName: "Add",
|
||||
parameterTypes: new[] {
|
||||
("mscorlib", "System", "String"),
|
||||
("mscorlib", "System", "Object"),
|
||||
}));
|
||||
yield break;
|
||||
}
|
||||
|
||||
var nodeTypeRef = context.Variables[node].VariableType;
|
||||
yield return Create(Ldloc, context.Variables[node]);
|
||||
yield return Create(Callvirt, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms", "ResourceDictionary"),
|
||||
methodName: "Add", paramCount: 1,
|
||||
predicate: md => TypeRefComparer.Default.Equals(md.Parameters[0].ParameterType, nodeTypeRef)));
|
||||
methodName: "Add",
|
||||
parameterTypes: new[] { (nodeTypeRef.Scope.Name, nodeTypeRef.Namespace, nodeTypeRef.Name) }));
|
||||
yield break;
|
||||
}
|
||||
|
||||
|
@ -1300,7 +1321,7 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
TypeAttributes.NestedPrivate) {
|
||||
BaseType = module.TypeSystem.Object,
|
||||
CustomAttributes = {
|
||||
new CustomAttribute (module.ImportCtorReference(("mscorlib", "System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), paramCount: 0)),
|
||||
new CustomAttribute (module.ImportCtorReference(("mscorlib", "System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), parameterTypes: null)),
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1366,8 +1387,8 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
//SetDataTemplate
|
||||
parentIl.Emit(Ldftn, loadTemplate);
|
||||
parentIl.Emit(Newobj, module.ImportCtorReference(("mscorlib", "System", "Func`1"),
|
||||
paramCount: 2,
|
||||
classArguments: new[] { ("mscorlib", "System", "Object") }));
|
||||
classArguments: new[] { ("mscorlib", "System", "Object") },
|
||||
paramCount: 2));
|
||||
|
||||
parentContext.IL.Emit(OpCodes.Callvirt, module.ImportPropertySetterReference(("Xamarin.Forms.Core", "Xamarin.Forms.Internals", "IDataTemplate"), propertyName: "LoadTemplate"));
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
MethodAttributes.SpecialName |
|
||||
MethodAttributes.RTSpecialName;
|
||||
|
||||
var parentctor = module.ImportCtorReference(parentType, paramCount: 0, predicate: md => (!md.IsPrivate && !md.IsStatic))
|
||||
?? module.ImportCtorReference(("mscorlib", "System", "Object"), paramCount: 0);
|
||||
var parentctor = module.ImportCtorReference(parentType, paramCount: 0) ?? module.ImportCtorReference(("mscorlib", "System", "Object"), parameterTypes: null);
|
||||
|
||||
var ctor = new MethodDefinition(".ctor", methodAttributes, voidType)
|
||||
{
|
||||
|
|
|
@ -25,18 +25,26 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
return y == null;
|
||||
if (y == null)
|
||||
return x == null;
|
||||
if (x.FullName != y.FullName)
|
||||
|
||||
//strip the leading `&` as byref typered fullnames have a `&`
|
||||
var xname = x.FullName.EndsWith("&", StringComparison.InvariantCulture) ? x.FullName.Substring(0, x.FullName.Length - 1) : x.FullName;
|
||||
var yname = y.FullName.EndsWith("&", StringComparison.InvariantCulture) ? y.FullName.Substring(0, y.FullName.Length - 1) : y.FullName;
|
||||
if (xname != yname)
|
||||
return false;
|
||||
var xasm = GetAssembly(x);
|
||||
var yasm = GetAssembly(y);
|
||||
|
||||
//standard types comes from either mscorlib. System.Runtime or netstandard. Assume they are equivalent
|
||||
if ( (xasm.StartsWith("System.Runtime", StringComparison.Ordinal)
|
||||
if (( xasm.StartsWith("System.Runtime", StringComparison.Ordinal)
|
||||
|| xasm.StartsWith("System", StringComparison.Ordinal)
|
||||
|| xasm.StartsWith("mscorlib", StringComparison.Ordinal)
|
||||
|| xasm.StartsWith("netstandard", StringComparison.Ordinal))
|
||||
&& (yasm.StartsWith("System.Runtime", StringComparison.Ordinal)
|
||||
|| xasm.StartsWith("netstandard", StringComparison.Ordinal)
|
||||
|| xasm.StartsWith("System.Xml", StringComparison.Ordinal))
|
||||
&& ( yasm.StartsWith("System.Runtime", StringComparison.Ordinal)
|
||||
|| yasm.StartsWith("System", StringComparison.Ordinal)
|
||||
|| yasm.StartsWith("mscorlib", StringComparison.Ordinal)
|
||||
|| yasm.StartsWith("netstandard", StringComparison.Ordinal)))
|
||||
|| yasm.StartsWith("netstandard", StringComparison.Ordinal)
|
||||
|| yasm.StartsWith("System.Xml", StringComparison.Ordinal)))
|
||||
return true;
|
||||
return xasm == yasm;
|
||||
}
|
||||
|
@ -215,7 +223,7 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
|
||||
public static CustomAttribute GetCustomAttribute(this TypeReference typeRef, ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) attributeType)
|
||||
{
|
||||
return typeRef.GetCustomAttribute(module.ImportReference(module.GetTypeDefinition(attributeType)));
|
||||
return typeRef.GetCustomAttribute(module.ImportReference(attributeType));
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
|
|
|
@ -272,16 +272,16 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
|
||||
//First using the ResourceLoader
|
||||
var nop = Instruction.Create(Nop);
|
||||
var getResourceProvider = module.ImportPropertyGetterReference(("Xamarin.Forms.Core", "Xamarin.Forms.Internals", "ResourceLoader"), "ResourceProvider");
|
||||
var getResourceProvider = module.ImportPropertyGetterReference(("Xamarin.Forms.Core", "Xamarin.Forms.Internals", "ResourceLoader"), "ResourceProvider", isStatic: true);
|
||||
il.Emit(Call, getResourceProvider);
|
||||
il.Emit(Brfalse, nop);
|
||||
il.Emit(Call, getResourceProvider);
|
||||
|
||||
il.Emit(Ldtoken, module.ImportReference(initComp.DeclaringType));
|
||||
il.Emit(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", paramCount: 1, predicate: md => md.IsStatic));
|
||||
il.Emit(Call, module.ImportMethodReference(("mscorlib", "System.Reflection", "IntrospectionExtensions"), methodName: "GetTypeInfo", paramCount: 1, predicate: md => md.IsStatic));
|
||||
il.Emit(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
|
||||
il.Emit(Call, module.ImportMethodReference(("mscorlib", "System.Reflection", "IntrospectionExtensions"), methodName: "GetTypeInfo", parameterTypes: new[] { ("mscorlib", "System", "Type") }, isStatic: true));
|
||||
il.Emit(Callvirt, module.ImportPropertyGetterReference(("mscorlib", "System.Reflection", "TypeInfo"), propertyName: "Assembly", flatten: true));
|
||||
il.Emit(Callvirt, module.ImportMethodReference(("mscorlib", "System.Reflection", "Assembly"), methodName: "GetName", paramCount: 0)); //assemblyName
|
||||
il.Emit(Callvirt, module.ImportMethodReference(("mscorlib", "System.Reflection", "Assembly"), methodName: "GetName", parameterTypes: null)); //assemblyName
|
||||
|
||||
il.Emit(Ldstr, resourcePath); //resourcePath
|
||||
il.Emit(Callvirt, module.ImportMethodReference(("mscorlib", "System", "Func`3"),
|
||||
|
@ -297,12 +297,12 @@ namespace Xamarin.Forms.Build.Tasks
|
|||
//Or using the deprecated XamlLoader
|
||||
nop = Instruction.Create(Nop);
|
||||
|
||||
var getXamlFileProvider = module.ImportPropertyGetterReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XamlLoader"), propertyName: "XamlFileProvider");
|
||||
var getXamlFileProvider = module.ImportPropertyGetterReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Internals", "XamlLoader"), propertyName: "XamlFileProvider", isStatic: true);
|
||||
il.Emit(Call, getXamlFileProvider);
|
||||
il.Emit(Brfalse, nop);
|
||||
il.Emit(Call, getXamlFileProvider);
|
||||
il.Emit(Ldarg_0);
|
||||
il.Emit(Call, module.ImportMethodReference(("mscorlib", "System", "Object"), methodName: "GetType", paramCount: 0));
|
||||
il.Emit(Call, module.ImportMethodReference(("mscorlib", "System", "Object"), methodName: "GetType", parameterTypes: null));
|
||||
il.Emit(Callvirt, module.ImportMethodReference(("mscorlib", "System", "Func`2"),
|
||||
methodName: "Invoke",
|
||||
paramCount: 1,
|
||||
|
|
|
@ -167,6 +167,13 @@ namespace Xamarin.Forms.ControlGallery.iOS
|
|||
{
|
||||
// e.NativeView.AccessibilityIdentifier = e.View.StyleId;
|
||||
}
|
||||
|
||||
if (e.NativeView != null)
|
||||
{
|
||||
var view = e.NativeView;
|
||||
var tapGestureRecognizer = new UITapGestureRecognizer(() => Reset("")) { NumberOfTapsRequired = 5 };
|
||||
view.AddGestureRecognizer(tapGestureRecognizer);
|
||||
}
|
||||
};
|
||||
|
||||
if (App.IOSVersion == 11)
|
||||
|
@ -190,6 +197,7 @@ namespace Xamarin.Forms.ControlGallery.iOS
|
|||
MessagingCenter.Subscribe<NativeBindingGalleryPage>(this, NativeBindingGalleryPage.ReadyForNativeBindingsMessage, AddNativeBindings);
|
||||
|
||||
LoadApplication(app);
|
||||
|
||||
return base.FinishedLaunching(uiApplication, launchOptions);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
const string ListView2 = "Accessory with RecycleElement";
|
||||
const string ListView3 = "Accessory with RetainElement";
|
||||
|
||||
[Preserve(AllMembers = true)]
|
||||
public class AccessoryViewCell : ViewCell
|
||||
{
|
||||
public AccessoryViewCell()
|
||||
|
@ -29,6 +30,7 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
}
|
||||
}
|
||||
|
||||
[Preserve(AllMembers = true)]
|
||||
public class AccessoryViewCellWithContextActions : AccessoryViewCell
|
||||
{
|
||||
public AccessoryViewCellWithContextActions()
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace Xamarin.Forms.Controls
|
|||
readonly ListView _listView;
|
||||
protected abstract DataTemplate CellTemplate();
|
||||
|
||||
_43313ViewModel ViewModel => BindingContext as _43313ViewModel;
|
||||
|
||||
protected Bugzilla43313_Template()
|
||||
{
|
||||
BindingContext = new _43313ViewModel();
|
||||
|
@ -48,7 +50,7 @@ namespace Xamarin.Forms.Controls
|
|||
ItemTemplate = CellTemplate()
|
||||
};
|
||||
|
||||
_listView.SetBinding(ListView.ItemsSourceProperty, new Binding("ListViewContent"));
|
||||
_listView.SetBinding(ListView.ItemsSourceProperty, new Binding(nameof(_43313ViewModel.ListViewContent)));
|
||||
_listView.ItemTapped += (sender, e) => ((ListView)sender).SelectedItem = null;
|
||||
|
||||
var instructions = new Label() { FontSize = 12, Text = "Tap the 'Add Item' button; a new item should be added to the bottom of the list and the list should scroll smoothly to display it. If the list scrolls back to the top before scrolling down to the new item, the test has failed." };
|
||||
|
@ -69,14 +71,14 @@ namespace Xamarin.Forms.Controls
|
|||
{
|
||||
string str = $"Item {ItemCount++}";
|
||||
var item = new _43313Model { Name = str };
|
||||
(BindingContext as _43313ViewModel).ListViewContent.Add(item);
|
||||
ViewModel.ListViewContent.Add(item);
|
||||
|
||||
_listView.ScrollTo(item, ScrollToPosition.End, true);
|
||||
}
|
||||
|
||||
void BtnBottomOnClicked(object sender, EventArgs e)
|
||||
{
|
||||
_43313Model item = (BindingContext as _43313ViewModel).ListViewContent.Last();
|
||||
_43313Model item = ViewModel.ListViewContent.Last();
|
||||
_listView.ScrollTo(item, ScrollToPosition.End, true);
|
||||
}
|
||||
|
||||
|
@ -129,7 +131,7 @@ namespace Xamarin.Forms.Controls
|
|||
return new DataTemplate(() =>
|
||||
{
|
||||
var label = new Label { FontSize = 16, VerticalOptions = LayoutOptions.Center };
|
||||
label.SetBinding(Label.TextProperty, "Name");
|
||||
label.SetBinding(Label.TextProperty, nameof(_43313Model.Name));
|
||||
int height = 60 + new Random().Next(10, 100);
|
||||
|
||||
return new ViewCell
|
||||
|
@ -157,7 +159,7 @@ namespace Xamarin.Forms.Controls
|
|||
return new DataTemplate(() =>
|
||||
{
|
||||
var label = new Label { FontSize = 16, VerticalOptions = LayoutOptions.Center };
|
||||
label.SetBinding(Label.TextProperty, "Name");
|
||||
label.SetBinding(Label.TextProperty, nameof(_43313Model.Name));
|
||||
|
||||
label.FontSize = 12 + new Random().Next(1, 6);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Xamarin.Forms.Controls
|
|||
{
|
||||
protected override void Init()
|
||||
{
|
||||
var button = new Button { Text = "Click to call DisplayAlert twice" };
|
||||
var button = new Button { Text = "Click to call DisplayAlert three times" };
|
||||
|
||||
button.Clicked += (sender, args) =>
|
||||
{
|
||||
|
@ -29,6 +29,11 @@ namespace Xamarin.Forms.Controls
|
|||
{
|
||||
await DisplayAlert("Second", "Text", "Cancel");
|
||||
}));
|
||||
|
||||
Device.BeginInvokeOnMainThread(new Action(async () =>
|
||||
{
|
||||
await DisplayAlert("Three", "Text", "Cancel");
|
||||
}));
|
||||
};
|
||||
|
||||
Content = button;
|
||||
|
|
|
@ -87,16 +87,15 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
|
||||
protected override void Init()
|
||||
{
|
||||
_status.Text = _groupsAppearing.Text = _groupsDisappearing.Text = "";
|
||||
_Appearing = _Disappearing = 0;
|
||||
_scroll.SetScrolledPosition(0, 0);
|
||||
|
||||
InitTest(ListViewCachingStrategy.RecycleElement, true);
|
||||
}
|
||||
|
||||
void InitTest(ListViewCachingStrategy cachingStrategy, bool useTemplate)
|
||||
{
|
||||
_scroll.SetScrolledPosition(0, 0);
|
||||
|
||||
_status.Text = _groupsAppearing.Text = _groupsDisappearing.Text = "";
|
||||
_Appearing = _Disappearing = 0;
|
||||
|
||||
List<GroupedData> groups = GetGroups();
|
||||
|
||||
var listView = new ListView(cachingStrategy)
|
||||
|
@ -147,6 +146,10 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
|
||||
void NextButton_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
_status.Text = _groupsAppearing.Text = _groupsDisappearing.Text = "";
|
||||
_Appearing = _Disappearing = 0;
|
||||
_scroll.SetScrolledPosition(0, 0);
|
||||
|
||||
switch (_TestNumber)
|
||||
{
|
||||
default:
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
model.Change();
|
||||
}
|
||||
}
|
||||
|
||||
[Preserve(AllMembers = true)]
|
||||
public class Bugzilla45284Model : INotifyPropertyChanged
|
||||
{
|
||||
public List<Bugzilla45284TabModel> Tabs => new List<Bugzilla45284TabModel> {
|
||||
|
@ -39,7 +39,7 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Tabs)));
|
||||
}
|
||||
}
|
||||
|
||||
[Preserve(AllMembers = true)]
|
||||
public class Bugzilla45284TabModel
|
||||
{
|
||||
public string Title { get; set; } = "Title";
|
||||
|
|
|
@ -204,7 +204,12 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
|
||||
col2.Children.Add(MenuButton(nameof(DatePicker), () => new DatePicker()));
|
||||
col2.Children.Add(MenuButton(nameof(TimePicker), () => new TimePicker()));
|
||||
col2.Children.Add(MenuButton(nameof(Slider), () => new Slider()));
|
||||
|
||||
if (DateTime.Now > new DateTime(2018, 5, 28))
|
||||
{
|
||||
col2.Children.Add(MenuButton(nameof(Slider), () => new Slider()));
|
||||
}
|
||||
|
||||
col2.Children.Add(MenuButton(nameof(Switch), () => new Switch()));
|
||||
col2.Children.Add(MenuButton(nameof(Stepper), () => new Stepper()));
|
||||
col2.Children.Add(MenuButton(nameof(BoxView), () => new BoxView { BackgroundColor = Color.DarkMagenta, WidthRequest = 100, HeightRequest = 100 }));
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
#if UITEST
|
||||
using Xamarin.UITest;
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.None, 5955, "Group ListView Crashes when ItemSource is Cleared", PlatformAffected.iOS)]
|
||||
public class GroupListViewHeaderIndexOutOfRange : TestContentPage
|
||||
{
|
||||
const string ButtonId = "button";
|
||||
|
||||
public static ObservableCollection<SamplePack> Samples { get; set; }
|
||||
|
||||
public static ObservableCollection<Grouping<string, SamplePack>> Testing { get; set; }
|
||||
|
||||
public static void ResetList()
|
||||
{
|
||||
Testing.Clear();
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
Samples = new ObservableCollection<SamplePack>
|
||||
{
|
||||
new SamplePack {Info = "1"},
|
||||
new SamplePack {Info = "2"},
|
||||
new SamplePack {Info = "3"}
|
||||
};
|
||||
|
||||
var sorted = from sampleData in Samples
|
||||
orderby sampleData.Info
|
||||
group sampleData by sampleData.Info
|
||||
into sampleGroup
|
||||
select new Grouping<string, SamplePack>(sampleGroup.Key, sampleGroup);
|
||||
|
||||
Testing = new ObservableCollection<Grouping<string, SamplePack>>(sorted);
|
||||
|
||||
var groupLabel = new Label { FontSize = 18, TextColor = Color.FromHex("#1f1f1f"), HorizontalOptions = LayoutOptions.Start, HorizontalTextAlignment = TextAlignment.Start };
|
||||
groupLabel.SetBinding(Label.TextProperty, new Binding("Key", stringFormat: "{0} Music"));
|
||||
|
||||
var itemLabel = new Label { TextColor = Color.Black };
|
||||
itemLabel.SetBinding(Label.TextProperty, new Binding("Info"));
|
||||
|
||||
ListView TestingList = new ListView()
|
||||
{
|
||||
IsPullToRefreshEnabled = true,
|
||||
IsGroupingEnabled = true,
|
||||
GroupHeaderTemplate = new DataTemplate(() => new ViewCell
|
||||
{
|
||||
Height = 283,
|
||||
View = new StackLayout
|
||||
{
|
||||
Spacing = 0,
|
||||
Padding = 10,
|
||||
BackgroundColor = Color.Blue,
|
||||
Children = {
|
||||
new StackLayout{ Padding=5, BackgroundColor=Color.White, HeightRequest=30, Children = { groupLabel } }
|
||||
}
|
||||
}
|
||||
}),
|
||||
ItemTemplate = new DataTemplate(() => new ViewCell
|
||||
{
|
||||
View = itemLabel
|
||||
})
|
||||
};
|
||||
|
||||
TestingList.ItemsSource = Testing;
|
||||
|
||||
TestingList.BindingContext = Testing;
|
||||
|
||||
TestingList.RefreshCommand = new Command(() =>
|
||||
|
||||
{
|
||||
TestingList.IsRefreshing = true;
|
||||
|
||||
ResetList();
|
||||
|
||||
TestingList.IsRefreshing = false;
|
||||
});
|
||||
|
||||
Button button = new Button { Text = "Click here to cause crash. Pass if no crash!", Command = new Command(() => ResetList()), AutomationId = ButtonId };
|
||||
Content = new StackLayout { Children = { button, TestingList } };
|
||||
}
|
||||
|
||||
[Preserve(AllMembers = true)]
|
||||
public class Grouping<K, T> : ObservableCollection<T>
|
||||
{
|
||||
public Grouping(K key, IEnumerable<T> items)
|
||||
{
|
||||
Key = key;
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public K Key { get; }
|
||||
}
|
||||
|
||||
[Preserve(AllMembers = true)]
|
||||
public class SamplePack
|
||||
{
|
||||
public string Info { get; set; }
|
||||
}
|
||||
|
||||
#if UITEST
|
||||
[Test]
|
||||
public void GroupListViewHeaderIndexOutOfRangeTest()
|
||||
{
|
||||
RunningApp.WaitForElement(q => q.Marked(ButtonId));
|
||||
RunningApp.Tap(q => q.Marked(ButtonId));
|
||||
RunningApp.WaitForElement(q => q.Marked(ButtonId));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -242,6 +242,7 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)Issue1801.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue1683.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue1705_2.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)GroupListViewHeaderIndexOutOfRange.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue1975.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue1601.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue1717.cs" />
|
||||
|
|
|
@ -66,292 +66,15 @@
|
|||
<ItemGroup Condition=" '$(OS)' != 'Unix' ">
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- The IDE will look for a top level assembly resource called 'Xamarin.Forms.toolbox.xml' to -->
|
||||
<!-- load the toolbox metadata from. -->
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="toolbox\Xamarin.Forms.toolbox.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-EntryCell-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-EntryCell-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-EntryCell-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-EntryCell-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-EntryCell-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-EntryCell-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-EntryCell-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-EntryCell-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ImageCell-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ImageCell-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ImageCell-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ImageCell-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ImageCell-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ImageCell-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ImageCell-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ImageCell-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-SwitchCell-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-SwitchCell-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-SwitchCell-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-SwitchCell-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-SwitchCell-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-SwitchCell-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-SwitchCell-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-SwitchCell-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-TextCell-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-TextCell-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-TextCell-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-TextCell-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-TextCell-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-TextCell-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-TextCell-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-TextCell-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ViewCell-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ViewCell-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ViewCell-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ViewCell-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ViewCell-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ViewCell-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ViewCell-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\cell-ViewCell-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-AbsoluteLayout-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-AbsoluteLayout-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-AbsoluteLayout-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-AbsoluteLayout-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-AbsoluteLayout-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-AbsoluteLayout-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-AbsoluteLayout-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-AbsoluteLayout-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ContentView-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ContentView-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ContentView-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ContentView-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ContentView-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ContentView-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ContentView-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ContentView-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Frame-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Frame-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Frame-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Frame-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Frame-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Frame-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Frame-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Frame-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Grid-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Grid-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Grid-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Grid-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Grid-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Grid-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Grid-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-Grid-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-RelativeLayout-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-RelativeLayout-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-RelativeLayout-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-RelativeLayout-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-RelativeLayout-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-RelativeLayout-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-RelativeLayout-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-RelativeLayout-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ScrollView-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ScrollView-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ScrollView-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ScrollView-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ScrollView-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ScrollView-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ScrollView-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-ScrollView-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-StackLayout-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-StackLayout-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-StackLayout-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-StackLayout-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-StackLayout-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-StackLayout-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-StackLayout-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\layout-StackLayout-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ActivityIndicator-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ActivityIndicator-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ActivityIndicator-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ActivityIndicator-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ActivityIndicator-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ActivityIndicator-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ActivityIndicator-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ActivityIndicator-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-BoxView-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-BoxView-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-BoxView-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-BoxView-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-BoxView-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-BoxView-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-BoxView-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-BoxView-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Button-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Button-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Button-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Button-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Button-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Button-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Button-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Button-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-DatePicker-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-DatePicker-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-DatePicker-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-DatePicker-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-DatePicker-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-DatePicker-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-DatePicker-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-DatePicker-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Editor-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Editor-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Editor-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Editor-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Editor-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Editor-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Editor-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Editor-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Entry-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Entry-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Entry-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Entry-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Entry-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Entry-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Entry-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Entry-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Image-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Image-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Image-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Image-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Image-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Image-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Image-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Image-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Label-16%402x-1.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Label-16%402x-2.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Label-16%402x-3.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Label-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Label-16-1.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Label-16-2.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Label-16-3.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Label-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ListView-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ListView-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ListView-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ListView-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ListView-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ListView-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ListView-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ListView-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Map-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Map-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Map-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Map-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Map-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Map-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Map-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Map-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Picker-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Picker-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Picker-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Picker-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Picker-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Picker-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Picker-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Picker-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ProgressBar-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ProgressBar-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ProgressBar-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ProgressBar-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ProgressBar-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ProgressBar-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ProgressBar-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-ProgressBar-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-SearchBar-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-SearchBar-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-SearchBar-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-SearchBar-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-SearchBar-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-SearchBar-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-SearchBar-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-SearchBar-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Slider-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Slider-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Slider-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Slider-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Slider-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Slider-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Slider-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Slider-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Stepper-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Stepper-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Stepper-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Stepper-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Stepper-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Stepper-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Stepper-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Stepper-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Switch-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Switch-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Switch-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Switch-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Switch-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Switch-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Switch-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-Switch-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TableView-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TableView-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TableView-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TableView-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TableView-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TableView-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TableView-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TableView-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TimePicker-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TimePicker-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TimePicker-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TimePicker-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TimePicker-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TimePicker-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TimePicker-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-TimePicker-16~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-WebView-16%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-WebView-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-WebView-16~dark%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-WebView-16~dark.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-WebView-16~dark~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-WebView-16~dark~sel.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-WebView-16~sel%402x.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\mac\view-WebView-16~sel.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-BoxView-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\cell-EntryCell-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\cell-ImageCell-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\cell-SwitchCell-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\cell-TextCell-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\cell-ViewCell-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\layout-AbsoluteLayout-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\layout-ContentView-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\layout-Frame-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\layout-Grid-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\layout-RelativeLayout-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\layout-ScrollView-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\layout-StackLayout-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-ActivityIndicator-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-Button-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-DatePicker-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-Editor-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-Entry-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-Image-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-Label-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-ListView-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-Map-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-Picker-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-ProgressBar-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-SearchBar-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-Slider-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-Stepper-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-Switch-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-TableView-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-TimePicker-16.png" />
|
||||
<EmbeddedResource Include="toolbox\icons\win\view-WebView-16.png" />
|
||||
<EmbeddedResource Include="toolbox\Xamarin.Forms.toolbox.xml">
|
||||
<LogicalName>Xamarin.Forms.toolbox.xml</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Xamarin.Forms.Design.1.0.23-pre\build\Xamarin.Forms.Design.targets" Condition="Exists('..\packages\Xamarin.Forms.Design.1.0.23-pre\build\Xamarin.Forms.Design.targets') And '$(OS)' != 'Unix' " />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild" Condition=" '$(OS)' != 'Unix'">
|
||||
|
@ -360,4 +83,31 @@
|
|||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Xamarin.Forms.Design.1.0.23-pre\build\Xamarin.Forms.Design.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Forms.Design.1.0.23-pre\build\Xamarin.Forms.Design.targets'))" />
|
||||
</Target>
|
||||
|
||||
<!-- Ensure that all images in the 'mac' and 'win' subdirectories are included as embedded resources -->
|
||||
<!-- using a defined format. That format is "{platform}.{imagename}". We will look up images using -->
|
||||
<!-- exact-match logic so there's no guessework to figure out which image we need to load. -->
|
||||
<PropertyGroup>
|
||||
<AssignTargetPathsDependsOn>
|
||||
$(AssignTargetPathsDependsOn);
|
||||
IncludeToolboxImages
|
||||
</AssignTargetPathsDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="IncludeToolboxImages">
|
||||
<!-- Be explicit about the prefix rather than relying on the directory name being exactly what we need -->
|
||||
<ItemGroup>
|
||||
<Images Include="toolbox\icons\mac\*.png">
|
||||
<Prefix>mac</Prefix>
|
||||
</Images>
|
||||
<Images Include="toolbox\icons\win\*.png">
|
||||
<Prefix>win</Prefix>
|
||||
</Images>
|
||||
</ItemGroup>
|
||||
|
||||
<CreateItem Include="@(Images)" AdditionalMetadata="LogicalName=%(Prefix).%(Filename)%(Extension)">
|
||||
<Output TaskParameter="Include" ItemName="EmbeddedResource" />
|
||||
</CreateItem>
|
||||
</Target>
|
||||
|
||||
</Project>
|
|
@ -97,7 +97,7 @@
|
|||
<TimePicker />
|
||||
</Snippet>
|
||||
</Item>
|
||||
<Item Class="Xamarin.Forms.WebView" Name="WebViewWebView" Image="view-WebView.png">
|
||||
<Item Class="Xamarin.Forms.WebView" Name="WebView" Image="view-WebView.png">
|
||||
<Snippet>
|
||||
<WebView Source="" />
|
||||
</Snippet>
|
||||
|
@ -124,6 +124,11 @@
|
|||
<AbsoluteLayout></AbsoluteLayout>
|
||||
</Snippet>
|
||||
</Item>
|
||||
<Item Class="Xamarin.Forms.FlexLayout" Name="FlexLayout" Image="layout-FlexLayout.png">
|
||||
<Snippet>
|
||||
<FlexLayout></FlexLayout>
|
||||
</Snippet>
|
||||
</Item>
|
||||
<Item Class="Xamarin.Forms.Grid" Name="Grid" Image="layout-Grid.png">
|
||||
<Snippet>
|
||||
<Grid>
|
||||
|
|
После Ширина: | Высота: | Размер: 121 B |
После Ширина: | Высота: | Размер: 169 B |
Двоичные данные
Xamarin.Forms.Core.Design/toolbox/icons/mac/layout-FlexLayout-16~dark.png
Normal file
После Ширина: | Высота: | Размер: 121 B |
Двоичные данные
Xamarin.Forms.Core.Design/toolbox/icons/mac/layout-FlexLayout-16~dark@2x.png
Normal file
После Ширина: | Высота: | Размер: 165 B |
Двоичные данные
Xamarin.Forms.Core.Design/toolbox/icons/mac/layout-FlexLayout-16~dark~sel.png
Normal file
После Ширина: | Высота: | Размер: 118 B |
Двоичные данные
Xamarin.Forms.Core.Design/toolbox/icons/mac/layout-FlexLayout-16~dark~sel@2x.png
Normal file
После Ширина: | Высота: | Размер: 160 B |
Двоичные данные
Xamarin.Forms.Core.Design/toolbox/icons/mac/layout-FlexLayout-16~sel.png
Normal file
После Ширина: | Высота: | Размер: 118 B |
Двоичные данные
Xamarin.Forms.Core.Design/toolbox/icons/mac/layout-FlexLayout-16~sel@2x.png
Normal file
После Ширина: | Высота: | Размер: 160 B |
Двоичные данные
Xamarin.Forms.Core.Design/toolbox/icons/mac/view-Label-16-1.png
До Ширина: | Высота: | Размер: 144 B |
Двоичные данные
Xamarin.Forms.Core.Design/toolbox/icons/mac/view-Label-16-3.png
До Ширина: | Высота: | Размер: 206 B |
Двоичные данные
Xamarin.Forms.Core.Design/toolbox/icons/mac/view-Label-16.png
До Ширина: | Высота: | Размер: 144 B После Ширина: | Высота: | Размер: 206 B |
До Ширина: | Высота: | Размер: 198 B |
До Ширина: | Высота: | Размер: 207 B |
До Ширина: | Высота: | Размер: 213 B |
Двоичные данные
Xamarin.Forms.Core.Design/toolbox/icons/mac/view-Label-16@2x.png
До Ширина: | Высота: | Размер: 198 B После Ширина: | Высота: | Размер: 216 B |
До Ширина: | Высота: | Размер: 149 B После Ширина: | Высота: | Размер: 149 B |
После Ширина: | Высота: | Размер: 209 B |
После Ширина: | Высота: | Размер: 144 B |
Двоичные данные
Xamarin.Forms.Core.Design/toolbox/icons/mac/view-Label-16~dark~sel@2x.png
Normal file
После Ширина: | Высота: | Размер: 199 B |
После Ширина: | Высота: | Размер: 144 B |
После Ширина: | Высота: | Размер: 199 B |
После Ширина: | Высота: | Размер: 135 B |
|
@ -9,6 +9,8 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
{
|
||||
const string NormalStateName = "Normal";
|
||||
const string InvalidStateName = "Invalid";
|
||||
const string FocusedStateName = "Focused";
|
||||
const string DisabledStateName = "Disabled";
|
||||
const string CommonStatesName = "CommonStates";
|
||||
|
||||
static VisualStateGroupList CreateTestStateGroups()
|
||||
|
@ -17,9 +19,13 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
var visualStateGroup = new VisualStateGroup { Name = CommonStatesName };
|
||||
var normalState = new VisualState { Name = NormalStateName };
|
||||
var invalidState = new VisualState { Name = InvalidStateName };
|
||||
var focusedState = new VisualState { Name = FocusedStateName };
|
||||
var disabledState = new VisualState { Name = DisabledStateName };
|
||||
|
||||
visualStateGroup.States.Add(normalState);
|
||||
visualStateGroup.States.Add(invalidState);
|
||||
visualStateGroup.States.Add(focusedState);
|
||||
visualStateGroup.States.Add(disabledState);
|
||||
|
||||
stateGroups.Add(visualStateGroup);
|
||||
|
||||
|
@ -172,9 +178,39 @@ namespace Xamarin.Forms.Core.UnitTests
|
|||
{
|
||||
IList<VisualStateGroup> vsgs = CreateTestStateGroups();
|
||||
|
||||
var emptyStateName = new VisualState{Name = ""};
|
||||
var emptyStateName = new VisualState { Name = "" };
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => vsgs[0].States.Add(emptyStateName));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void VerifyVisualStateChanges()
|
||||
{
|
||||
var label1 = new Label();
|
||||
VisualStateManager.SetVisualStateGroups(label1, CreateTestStateGroups());
|
||||
|
||||
var groups1 = VisualStateManager.GetVisualStateGroups(label1);
|
||||
Assert.That(groups1[0].CurrentState.Name, Is.EqualTo(NormalStateName));
|
||||
|
||||
label1.IsEnabled = false;
|
||||
|
||||
groups1 = VisualStateManager.GetVisualStateGroups(label1);
|
||||
Assert.That(groups1[0].CurrentState.Name, Is.EqualTo(DisabledStateName));
|
||||
|
||||
|
||||
label1.SetValue(VisualElement.IsFocusedPropertyKey, true);
|
||||
groups1 = VisualStateManager.GetVisualStateGroups(label1);
|
||||
Assert.That(groups1[0].CurrentState.Name, Is.EqualTo(DisabledStateName));
|
||||
|
||||
label1.IsEnabled = true;
|
||||
groups1 = VisualStateManager.GetVisualStateGroups(label1);
|
||||
Assert.That(groups1[0].CurrentState.Name, Is.EqualTo(FocusedStateName));
|
||||
|
||||
|
||||
label1.SetValue(VisualElement.IsFocusedPropertyKey, false);
|
||||
groups1 = VisualStateManager.GetVisualStateGroups(label1);
|
||||
Assert.That(groups1[0].CurrentState.Name, Is.EqualTo(NormalStateName));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ namespace Xamarin.Forms
|
|||
|
||||
public static readonly BindableProperty InputTransparentProperty = BindableProperty.Create("InputTransparent", typeof(bool), typeof(VisualElement), default(bool));
|
||||
|
||||
public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create("IsEnabled", typeof(bool),
|
||||
public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create("IsEnabled", typeof(bool),
|
||||
typeof(VisualElement), true, propertyChanged: OnIsEnabledPropertyChanged);
|
||||
|
||||
static readonly BindablePropertyKey XPropertyKey = BindableProperty.CreateReadOnly("X", typeof(double), typeof(VisualElement), default(double));
|
||||
|
@ -89,7 +89,7 @@ namespace Xamarin.Forms
|
|||
public static readonly BindableProperty MinimumHeightRequestProperty = BindableProperty.Create("MinimumHeightRequest", typeof(double), typeof(VisualElement), -1d, propertyChanged: OnRequestChanged);
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public static readonly BindablePropertyKey IsFocusedPropertyKey = BindableProperty.CreateReadOnly("IsFocused",
|
||||
public static readonly BindablePropertyKey IsFocusedPropertyKey = BindableProperty.CreateReadOnly("IsFocused",
|
||||
typeof(bool), typeof(VisualElement), default(bool), propertyChanged: OnIsFocusedPropertyChanged);
|
||||
|
||||
public static readonly BindableProperty IsFocusedProperty = IsFocusedPropertyKey.BindableProperty;
|
||||
|
@ -278,15 +278,17 @@ namespace Xamarin.Forms
|
|||
set { SetValue(StyleProperty, value); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
[TypeConverter(typeof(ListStringTypeConverter))]
|
||||
public IList<string> StyleClass {
|
||||
public IList<string> StyleClass
|
||||
{
|
||||
get { return @class; }
|
||||
set { @class = value; }
|
||||
}
|
||||
|
||||
[TypeConverter(typeof(ListStringTypeConverter))]
|
||||
public IList<string> @class {
|
||||
public IList<string> @class
|
||||
{
|
||||
get { return _mergedStyle.StyleClass; }
|
||||
set { _mergedStyle.StyleClass = value; }
|
||||
}
|
||||
|
@ -455,7 +457,8 @@ namespace Xamarin.Forms
|
|||
|
||||
public ResourceDictionary Resources
|
||||
{
|
||||
get {
|
||||
get
|
||||
{
|
||||
if (_resources != null)
|
||||
return _resources;
|
||||
_resources = new ResourceDictionary();
|
||||
|
@ -789,6 +792,22 @@ namespace Xamarin.Forms
|
|||
focus(this, new FocusEventArgs(this, true));
|
||||
}
|
||||
|
||||
protected internal virtual void ChangeVisualState()
|
||||
{
|
||||
if (!IsEnabled)
|
||||
{
|
||||
VisualStateManager.GoToState(this, VisualStateManager.CommonStates.Disabled);
|
||||
}
|
||||
else if (IsFocused)
|
||||
{
|
||||
VisualStateManager.GoToState(this, VisualStateManager.CommonStates.Focused);
|
||||
}
|
||||
else
|
||||
{
|
||||
VisualStateManager.GoToState(this, VisualStateManager.CommonStates.Normal);
|
||||
}
|
||||
}
|
||||
|
||||
static void FlowDirectionChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
var self = bindable as IFlowDirectionController;
|
||||
|
@ -814,9 +833,7 @@ namespace Xamarin.Forms
|
|||
|
||||
var isEnabled = (bool)newValue;
|
||||
|
||||
VisualStateManager.GoToState(element, isEnabled
|
||||
? VisualStateManager.CommonStates.Normal
|
||||
: VisualStateManager.CommonStates.Disabled);
|
||||
element.ChangeVisualState();
|
||||
}
|
||||
|
||||
static void OnIsFocusedPropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
|
||||
|
@ -838,9 +855,7 @@ namespace Xamarin.Forms
|
|||
element.OnUnfocus();
|
||||
}
|
||||
|
||||
VisualStateManager.GoToState(element, isFocused
|
||||
? VisualStateManager.CommonStates.Focused
|
||||
: VisualStateManager.CommonStates.Normal);
|
||||
element.ChangeVisualState();
|
||||
}
|
||||
|
||||
static void OnRequestChanged(BindableObject bindable, object oldvalue, object newvalue)
|
||||
|
@ -903,7 +918,8 @@ namespace Xamarin.Forms
|
|||
{
|
||||
public override object ConvertFromInvariantString(string value)
|
||||
{
|
||||
if (value != null) {
|
||||
if (value != null)
|
||||
{
|
||||
if (value.Equals("true", StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
if (value.Equals("visible", StringComparison.OrdinalIgnoreCase))
|
||||
|
|
|
@ -81,6 +81,7 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
void OnCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
List.DataContext = new CollectionViewSource { Source = Element.ItemsSource, IsSourceGrouped = Element.IsGroupingEnabled };
|
||||
List.UpdateLayout();
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
public abstract partial class Platform
|
||||
{
|
||||
internal static StatusBar MobileStatusBar => ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar") ? StatusBar.GetForCurrentView() : null;
|
||||
static Task<bool> s_currentAlert;
|
||||
|
||||
IToolbarProvider _toolbarProvider;
|
||||
|
||||
|
@ -102,12 +103,21 @@ namespace Xamarin.Forms.Platform.UWP
|
|||
if (options.Accept != null)
|
||||
alertDialog.PrimaryButtonText = options.Accept;
|
||||
|
||||
ContentDialogResult result = await alertDialog.ShowAsync();
|
||||
while (s_currentAlert != null)
|
||||
{
|
||||
await s_currentAlert;
|
||||
}
|
||||
|
||||
if (result == ContentDialogResult.Secondary)
|
||||
options.SetResult(false);
|
||||
else if (result == ContentDialogResult.Primary)
|
||||
options.SetResult(true);
|
||||
s_currentAlert = ShowAlert(alertDialog);
|
||||
options.SetResult(await s_currentAlert);
|
||||
s_currentAlert = null;
|
||||
}
|
||||
|
||||
static async Task<bool> ShowAlert(ContentDialog alert)
|
||||
{
|
||||
ContentDialogResult result = await alert.ShowAsync();
|
||||
|
||||
return result == ContentDialogResult.Primary;
|
||||
}
|
||||
|
||||
void ClearCommandBar()
|
||||
|
|
|
@ -982,10 +982,10 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
if (cell.HasContextActions)
|
||||
throw new NotSupportedException("Header cells do not support context actions");
|
||||
|
||||
var renderer = (CellRenderer)Internals.Registrar.Registered.GetHandlerForObject<IRegisterable>(cell);
|
||||
var renderer = (CellRenderer)Internals.Registrar.Registered.GetHandlerForObject<IRegisterable>(cell);
|
||||
|
||||
view = new HeaderWrapperView();
|
||||
view.AddSubview(renderer.GetCell(cell, null, tableView));
|
||||
view = new HeaderWrapperView { Cell = cell };
|
||||
view.AddSubview(renderer.GetCell(cell, null, tableView));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -995,8 +995,11 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
if (!List.IsGroupingEnabled)
|
||||
return;
|
||||
|
||||
var cell = TemplatedItemsView.TemplatedItems[(int)section];
|
||||
cell.SendDisappearing();
|
||||
if (headerView is HeaderWrapperView wrapper)
|
||||
{
|
||||
wrapper.Cell?.SendDisappearing();
|
||||
wrapper.Cell = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override nint NumberOfSections(UITableView tableView)
|
||||
|
@ -1272,6 +1275,7 @@ namespace Xamarin.Forms.Platform.iOS
|
|||
|
||||
internal class HeaderWrapperView : UIView
|
||||
{
|
||||
public Cell Cell { get; set; }
|
||||
public override void LayoutSubviews()
|
||||
{
|
||||
base.LayoutSubviews();
|
||||
|
|