зеркало из https://github.com/DeGsoft/maui-linux.git
Merge branch '3.2.0'
This commit is contained in:
Коммит
0610191b3d
|
@ -137,7 +137,7 @@ namespace Xamarin.Forms.Build.Tasks
|
||||||
var parentVar = Context.Variables[(IElementNode)parentNode];
|
var parentVar = Context.Variables[(IElementNode)parentNode];
|
||||||
string contentProperty;
|
string contentProperty;
|
||||||
|
|
||||||
if (CanAddToResourceDictionary(parentVar.VariableType, node, node, Context)) {
|
if (CanAddToResourceDictionary(parentVar, parentVar.VariableType, node, node, Context)) {
|
||||||
Context.IL.Emit(Ldloc, parentVar);
|
Context.IL.Emit(Ldloc, parentVar);
|
||||||
Context.IL.Append(AddToResourceDictionary(node, node, Context));
|
Context.IL.Append(AddToResourceDictionary(node, node, Context));
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ namespace Xamarin.Forms.Build.Tasks
|
||||||
TypeReference propertyType;
|
TypeReference propertyType;
|
||||||
Context.IL.Append(GetPropertyValue(parent, parentList.XmlName, Context, node, out propertyType));
|
Context.IL.Append(GetPropertyValue(parent, parentList.XmlName, Context, node, out propertyType));
|
||||||
|
|
||||||
if (CanAddToResourceDictionary(propertyType, node, node, Context)) {
|
if (CanAddToResourceDictionary(parent, propertyType, node, node, Context)) {
|
||||||
Context.IL.Append(AddToResourceDictionary(node, node, Context));
|
Context.IL.Append(AddToResourceDictionary(node, node, Context));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1220,15 +1220,23 @@ namespace Xamarin.Forms.Build.Tasks
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool CanAddToResourceDictionary(TypeReference collectionType, IElementNode node, IXmlLineInfo lineInfo, ILContext context)
|
static Dictionary<VariableDefinition, IList<string>> resourceNamesInUse = new Dictionary<VariableDefinition, IList<string>>();
|
||||||
|
static bool CanAddToResourceDictionary(VariableDefinition parent, TypeReference collectionType, IElementNode node, IXmlLineInfo lineInfo, ILContext context)
|
||||||
{
|
{
|
||||||
if ( collectionType.FullName != "Xamarin.Forms.ResourceDictionary"
|
if ( collectionType.FullName != "Xamarin.Forms.ResourceDictionary"
|
||||||
&& collectionType.ResolveCached().BaseType?.FullName != "Xamarin.Forms.ResourceDictionary")
|
&& collectionType.ResolveCached().BaseType?.FullName != "Xamarin.Forms.ResourceDictionary")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
if (node.Properties.ContainsKey(XmlName.xKey))
|
if (node.Properties.ContainsKey(XmlName.xKey)) {
|
||||||
|
var key = (node.Properties[XmlName.xKey] as ValueNode).Value as string;
|
||||||
|
if (!resourceNamesInUse.TryGetValue(parent, out var names))
|
||||||
|
resourceNamesInUse[parent] = (names = new List<string>());
|
||||||
|
if (names.Contains(key))
|
||||||
|
throw new XamlParseException($"A resource with the key '{key}' is already present in the ResourceDictionary.", lineInfo);
|
||||||
|
names.Add(key);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//is there a RD.Add() overrides that accepts this ?
|
//is there a RD.Add() overrides that accepts this ?
|
||||||
var nodeTypeRef = context.Variables[node].VariableType;
|
var nodeTypeRef = context.Variables[node].VariableType;
|
||||||
|
@ -1251,7 +1259,7 @@ namespace Xamarin.Forms.Build.Tasks
|
||||||
foreach (var instruction in GetPropertyValue(parent, propertyName, context, iXmlLineInfo, out propertyType))
|
foreach (var instruction in GetPropertyValue(parent, propertyName, context, iXmlLineInfo, out propertyType))
|
||||||
yield return instruction;
|
yield return instruction;
|
||||||
|
|
||||||
if (CanAddToResourceDictionary(propertyType, elementNode, iXmlLineInfo, context)) {
|
if (CanAddToResourceDictionary(parent, propertyType, elementNode, iXmlLineInfo, context)) {
|
||||||
foreach (var instruction in AddToResourceDictionary(elementNode, iXmlLineInfo, context))
|
foreach (var instruction in AddToResourceDictionary(elementNode, iXmlLineInfo, context))
|
||||||
yield return instruction;
|
yield return instruction;
|
||||||
yield break;
|
yield break;
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace Xamarin.Forms.Controls
|
||||||
{
|
{
|
||||||
FlowDirection = direction;
|
FlowDirection = direction;
|
||||||
Master = new FlowDirectionGalleryCP(direction) { Title = "Master", BackgroundColor = Color.Red };
|
Master = new FlowDirectionGalleryCP(direction) { Title = "Master", BackgroundColor = Color.Red };
|
||||||
Detail = new FlowDirectionGalleryCP(direction) { Title = "Detail" };
|
Detail = new NavigationPage(new FlowDirectionGalleryCP(direction) { Title = "Detail" });
|
||||||
IsPresented = true;
|
IsPresented = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,11 +47,8 @@ namespace Xamarin.Forms.Platform.iOS
|
||||||
InnerDelegate _innerDelegate;
|
InnerDelegate _innerDelegate;
|
||||||
nfloat _masterWidth = 0;
|
nfloat _masterWidth = 0;
|
||||||
EventedViewController _masterController;
|
EventedViewController _masterController;
|
||||||
|
|
||||||
MasterDetailPage _masterDetailPage;
|
MasterDetailPage _masterDetailPage;
|
||||||
|
|
||||||
bool _masterVisible;
|
bool _masterVisible;
|
||||||
|
|
||||||
VisualElementTracker _tracker;
|
VisualElementTracker _tracker;
|
||||||
|
|
||||||
Page PageController => Element as Page;
|
Page PageController => Element as Page;
|
||||||
|
@ -186,7 +183,7 @@ namespace Xamarin.Forms.Platform.iOS
|
||||||
_masterWidth = (nfloat)Math.Max(_masterWidth, masterBounds.Width);
|
_masterWidth = (nfloat)Math.Max(_masterWidth, masterBounds.Width);
|
||||||
|
|
||||||
if (!masterBounds.IsEmpty)
|
if (!masterBounds.IsEmpty)
|
||||||
MasterDetailPage.MasterBounds = new Rectangle(_masterWidth, 0, _masterWidth, masterBounds.Height);
|
MasterDetailPage.MasterBounds = new Rectangle(0, 0, _masterWidth, masterBounds.Height);
|
||||||
|
|
||||||
if (!detailsBounds.IsEmpty)
|
if (!detailsBounds.IsEmpty)
|
||||||
MasterDetailPage.DetailBounds = new Rectangle(0, 0, detailsBounds.Width, detailsBounds.Height);
|
MasterDetailPage.DetailBounds = new Rectangle(0, 0, detailsBounds.Width, detailsBounds.Height);
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Xamarin.Forms.Xaml.UnitTests.Gh3512">
|
||||||
|
<ContentPage.Resources>
|
||||||
|
<Style x:Key="foo" TargetType="Label"/>
|
||||||
|
<Style x:Key="foo" TargetType="Label"/>
|
||||||
|
</ContentPage.Resources>
|
||||||
|
</ContentPage>
|
|
@ -0,0 +1,48 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Xamarin.Forms.Core.UnitTests;
|
||||||
|
|
||||||
|
namespace Xamarin.Forms.Xaml.UnitTests
|
||||||
|
{
|
||||||
|
[XamlCompilation(XamlCompilationOptions.Skip)]
|
||||||
|
public partial class Gh3512 : ContentPage
|
||||||
|
{
|
||||||
|
public Gh3512()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Gh3512(bool useCompiledXaml)
|
||||||
|
{
|
||||||
|
//this stub will be replaced at compile time
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[TestFixture]
|
||||||
|
class Tests
|
||||||
|
{
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
Device.PlatformServices = new MockPlatformServices();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TearDown]
|
||||||
|
public void TearDown()
|
||||||
|
{
|
||||||
|
Device.PlatformServices = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(false), TestCase(true)]
|
||||||
|
public void ThrowsOnDuplicateXKey(bool useCompiledXaml)
|
||||||
|
{
|
||||||
|
if (useCompiledXaml)
|
||||||
|
Assert.Throws<XamlParseException>(() => MockCompiler.Compile(typeof(Gh3512)));
|
||||||
|
else
|
||||||
|
Assert.Throws<ArgumentException>(() => new Gh3512(useCompiledXaml));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -634,6 +634,9 @@
|
||||||
<Compile Include="Issues\Gh3280.xaml.cs">
|
<Compile Include="Issues\Gh3280.xaml.cs">
|
||||||
<DependentUpon>Gh3280.xaml</DependentUpon>
|
<DependentUpon>Gh3280.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Issues\Gh3512.xaml.cs">
|
||||||
|
<DependentUpon>Gh3512.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="..\.nuspec\Xamarin.Forms.Debug.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('..\.nuspec\Xamarin.Forms.Build.Tasks.dll')" />
|
<Import Project="..\.nuspec\Xamarin.Forms.Debug.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('..\.nuspec\Xamarin.Forms.Build.Tasks.dll')" />
|
||||||
|
@ -1152,6 +1155,10 @@
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Issues\Gh3512.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||||
|
|
Загрузка…
Ссылка в новой задаче