This commit is contained in:
Rui Marinho 2019-09-29 21:38:19 +01:00
Родитель c56c216f94 b6bee5f169
Коммит fdba6fb254
53 изменённых файлов: 1264 добавлений и 200 удалений

Просмотреть файл

@ -11,8 +11,9 @@
<AssemblyName>Embedding.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<SkipMicrosoftUIXamlCheckTargetPlatformVersion>true</SkipMicrosoftUIXamlCheckTargetPlatformVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Просмотреть файл

@ -11,8 +11,9 @@
<AssemblyName>PagesGallery.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<SkipMicrosoftUIXamlCheckTargetPlatformVersion>true</SkipMicrosoftUIXamlCheckTargetPlatformVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
<FileAlignment>512</FileAlignment>

Просмотреть файл

@ -371,6 +371,8 @@
</ItemGroup>
<ItemGroup>
<AndroidEnvironment Include="Environment.txt" />
</ItemGroup>
<ItemGroup>
<ProguardConfiguration Include="..\.nuspec\proguard.cfg">
<Link>proguard.cfg</Link>
</ProguardConfiguration>

Просмотреть файл

@ -12,8 +12,9 @@
<AssemblyName>Xamarin.Forms.ControlGallery.WindowsUniversal</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<SkipMicrosoftUIXamlCheckTargetPlatformVersion>true</SkipMicrosoftUIXamlCheckTargetPlatformVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
<FileAlignment>512</FileAlignment>

Просмотреть файл

@ -45,6 +45,7 @@ namespace Xamarin.Forms.Controls.Issues
};
}
[Preserve(AllMembers = true)]
public class President
{
public President (string name, int position, string image)
@ -70,7 +71,8 @@ namespace Xamarin.Forms.Controls.Issues
var image = new Image
{
HorizontalOptions = LayoutOptions.Start,
Aspect = Aspect.AspectFill
Aspect = Aspect.AspectFill,
AutomationId = "ImageLoaded",
};
var source = new UriImageSource {
@ -86,6 +88,7 @@ namespace Xamarin.Forms.Controls.Issues
}
}
[Preserve(AllMembers = true)]
public class UriConverter : IValueConverter
{
@ -105,6 +108,7 @@ namespace Xamarin.Forms.Controls.Issues
[Test]
public void TestDoesntCrashWithCachingDisable ()
{
RunningApp.WaitForElement("ImageLoaded");
RunningApp.ScrollDown ();
RunningApp.ScrollDown ();
}

Просмотреть файл

@ -0,0 +1,164 @@
using System;
using Xamarin.Forms.Internals;
using Xamarin.Forms.CustomAttributes;
#if UITEST
using Xamarin.Forms.Core.UITests;
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.Picker)]
[Category(UITestCategories.DatePicker)]
[Category(UITestCategories.TimePicker)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 5159, "[Android] Calling Focus on all Pickers running an API 28 devices no longer opens Picker", PlatformAffected.Android)]
public class Issue5159 : TestContentPage
{
const string DatePickerButton = "DatePickerButton";
const string TimePickerButton = "TimePickerButton";
const string PickerButton = "PickerButton";
readonly string[] _pickerValues = { "Foo", "Bar", "42", "1337" };
protected override void Init()
{
var stackLayout = new StackLayout
{
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center
};
// DatePicker
var datePickerButton = new Button
{
Text = "Show DatePicker",
AutomationId = DatePickerButton
};
var datePicker = new DatePicker
{
IsVisible = false
};
datePickerButton.Clicked += (s, a) =>
{
Device.BeginInvokeOnMainThread(() =>
{
if (datePicker.IsFocused)
datePicker.Unfocus();
datePicker.Focus();
});
};
// TimePicker
var timePickerButton = new Button
{
Text = "Show TimePicker",
AutomationId = TimePickerButton
};
var timePicker = new TimePicker
{
IsVisible = false
};
timePickerButton.Clicked += (s, a) =>
{
Device.BeginInvokeOnMainThread(() =>
{
if (timePicker.IsFocused)
timePicker.Unfocus();
timePicker.Focus();
});
};
// Picker
var pickerButton = new Button
{
Text = "Show Picker",
AutomationId = PickerButton
};
var picker = new Picker
{
IsVisible = false,
ItemsSource = _pickerValues
};
pickerButton.Clicked += (s, a) =>
{
Device.BeginInvokeOnMainThread(() =>
{
if (picker.IsFocused)
picker.Unfocus();
picker.Focus();
});
};
stackLayout.Children.Add(datePickerButton);
stackLayout.Children.Add(datePicker);
stackLayout.Children.Add(timePickerButton);
stackLayout.Children.Add(timePicker);
stackLayout.Children.Add(pickerButton);
stackLayout.Children.Add(picker);
Content = stackLayout;
}
#if UITEST && __ANDROID__
[Test]
[UiTest(typeof(DatePicker))]
public void InvisibleDatepickerShowsDialogOnFocus()
{
RunningApp.WaitForElement(DatePickerButton);
RunningApp.Screenshot("Issue 5159 page is showing in all it's glory");
RunningApp.Tap(DatePickerButton);
RunningApp.WaitForElement(x => x.Class("DatePicker"));
RunningApp.Screenshot("DatePicker is shown");
RunningApp.TapCoordinates(5, 100);
}
[Test]
[UiTest(typeof(TimePicker))]
public void InvisibleTimepickerShowsDialogOnFocus()
{
RunningApp.WaitForElement(TimePickerButton);
RunningApp.Screenshot("Issue 5159 page is showing in all it's glory");
RunningApp.Tap(TimePickerButton);
RunningApp.WaitForElement(x => x.Class("timePicker"));
RunningApp.Screenshot("TimePicker is shown");
RunningApp.TapCoordinates(5, 100);
}
[Test]
[UiTest(typeof(Picker))]
public void InvisiblePickerShowsDialogOnFocus()
{
RunningApp.WaitForElement(PickerButton);
RunningApp.Screenshot("Issue 5159 page is showing in all it's glory");
RunningApp.Tap(PickerButton);
RunningApp.WaitForElement("Foo");
RunningApp.Screenshot("Picker is shown");
RunningApp.Tap("Foo");
RunningApp.WaitForNoElement("Foo");
}
#endif
}
}

Просмотреть файл

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8" ?>
<controls:TestContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:Xamarin.Forms.Controls"
x:Class="Xamarin.Forms.Controls.Issues.Issue5354">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackLayout Orientation="Vertical" Spacing="5" Grid.Row="0" VerticalOptions="Center">
<Label x:Name="Label" LineBreakMode="WordWrap" Text="Switch between linear and grid layouts. If layouts appear as expected with proper spacing between items, the test passes." HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
<Button AutomationId="Button5354" Text="Switch to grid layout" HorizontalOptions="Center" VerticalOptions="Center" Clicked="ButtonClicked"/>
</StackLayout>
<CollectionView AutomationId="CollectionView5354" Grid.Row="1" ItemsSource="{Binding Items}">
<CollectionView.ItemsLayout>
<LinearItemsLayout Orientation="Vertical" ItemSpacing="5"/>
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<StackLayout Orientation="Vertical" Spacing="10" BackgroundColor="Beige" Padding="10">
<Image Source="{Binding Source}"/>
<Label Text="{Binding Text}" HorizontalTextAlignment="Center" AutomationId="{Binding AutomationId}"/>
</StackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
</controls:TestContentPage>

Просмотреть файл

@ -0,0 +1,146 @@
using System.Collections.ObjectModel;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using System;
using Xamarin.Forms.Xaml;
using System.Collections.Generic;
#if UITEST
using Xamarin.UITest;
using Xamarin.UITest.Queries;
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
using System.Linq;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.CollectionView)]
#endif
#if APP
[XamlCompilation(XamlCompilationOptions.Compile)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 5354, "[CollectionView] Updating the ItemsLayout type should refresh the layout", PlatformAffected.All)]
public partial class Issue5354 : TestContentPage
{
int count = 0;
#if APP
public Issue5354()
{
Device.SetFlags(new List<string> { CollectionView.CollectionViewExperimental });
InitializeComponent();
BindingContext = new ViewModel5354();
}
#endif
protected override void Init()
{
}
void ButtonClicked(object sender, EventArgs e)
{
var button = sender as Button;
var stackLayout = button.Parent as StackLayout;
var grid = stackLayout.Parent as Grid;
var collectionView = grid.Children[1] as CollectionView;
if (count % 2 == 0)
{
collectionView.ItemsLayout = new GridItemsLayout(ItemsLayoutOrientation.Vertical)
{
Span = 2,
HorizontalItemSpacing = 5,
VerticalItemSpacing = 5
};
button.Text = "Switch to linear layout";
}
else
{
collectionView.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Vertical)
{
ItemSpacing = 5
};
button.Text = "Switch to grid layout";
}
++count;
}
#if UITEST
[Test]
public void CollectionViewItemsLayoutUpdate()
{
RunningApp.WaitForElement("CollectionView5354");
RunningApp.WaitForElement("Button5354");
var colView = RunningApp.Query("CollectionView5354").Single();
for(var i=0; i<3; i++)
{
RunningApp.WaitForNoElement("NoElement", timeout: TimeSpan.FromSeconds(3));
AppResult[] lastCellResults = null;
RunningApp.QueryUntilPresent(() =>
{
RunningApp.DragCoordinates(colView.Rect.CenterX, colView.Rect.Y + colView.Rect.Height - 50, colView.Rect.CenterX, colView.Rect.Y + 5);
lastCellResults = RunningApp.Query("Image49");
return lastCellResults;
}, 100, 1);
RunningApp.Tap("Button5354");
}
}
#endif
}
[Preserve(AllMembers = true)]
public class ViewModel5354
{
public ObservableCollection<Model5354> Items { get; set; }
public ViewModel5354()
{
var collection = new ObservableCollection<Model5354>();
var pageSize = 50;
for (var i = 0; i < pageSize; i++)
{
collection.Add(new Model5354
{
Text = "Image" + i,
Source = i % 2 == 0 ?
"https://upload.wikimedia.org/wikipedia/commons/thumb/5/5d/Kamchatka_Brown_Bear_near_Dvuhyurtochnoe_on_2015-07-23.jpg/320px-Kamchatka_Brown_Bear_near_Dvuhyurtochnoe_on_2015-07-23.jpg" :
"https://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/Elephant_%40_kabini.jpg/180px-Elephant_%40_kabini.jpg",
AutomationId = "Image" + i
});
}
Items = collection;
}
}
[Preserve(AllMembers = true)]
public class Model5354
{
public string Text { get; set; }
public string Source { get; set; }
public string AutomationId { get; set; }
public Model5354()
{
}
}
}

Просмотреть файл

@ -0,0 +1,63 @@
using System;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.UITest.iOS;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 7311, "[Bug] [Android] Error back hardware button with Picker", PlatformAffected.Android)]
public class Issue7311 : TestContentPage
{
const string FirstPickerItem = "Uno";
const string PickerId = "CaptainPickard";
readonly string[] _items = { FirstPickerItem, "Dos", "Tres" };
protected override void Init()
{
var picker = new Picker
{
ItemsSource = _items,
AutomationId = PickerId
};
Content = new StackLayout()
{
Children =
{
new Label()
{
Text = "Open Picker. Click hardware back button to close picker. Click hardware button a second time and it should navigate back to gallery"
},
picker
}
};
}
#if UITEST && __ANDROID__
[Test]
public void OpeningPickerPressingBackButtonTwiceShouldNotOpenPickerAgain()
{
RunningApp.WaitForElement(PickerId);
RunningApp.Tap(PickerId);
RunningApp.WaitForElement(FirstPickerItem);
RunningApp.Back();
RunningApp.WaitForNoElement(FirstPickerItem);
RunningApp.Back();
RunningApp.WaitForNoElement(FirstPickerItem, "Picker is again visible after second back button press", TimeSpan.FromSeconds(10));
RunningApp.Screenshot("Back at the previous page, not showing the picker again");
}
#endif
}
}

Просмотреть файл

@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
using System.Linq;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.CollectionView)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 7395, "Changing ItemTemplate does not work as expected", PlatformAffected.Android)]
public class Issue7395 : TestContentPage
{
CollectionView _collectionView;
public Issue7395()
{
Title = "Issue 7395";
}
protected override void Init()
{
var instructions = new Label
{
Text = "Click Two Columns. If all cells render correctly with 2 columns, then click Three Columns. If all cells render correctly with 3 columns, then the test passes."
};
var button1 = new Button
{
Text = "Two columns",
AutomationId = "TwoCol"
};
button1.Clicked += OnButton1Clicked;
var button2 = new Button
{
Text = "Three columns",
AutomationId = "ThreeCol"
};
button2.Clicked += OnButton2Clicked;
_collectionView = new CollectionView
{
BackgroundColor = Color.LightGreen,
SelectionMode = SelectionMode.None,
HeightRequest = 500
};
var lines = new List<Issue7395Model>();
for (int i = 0; i < 30; i++)
{
lines.Add(new Issue7395Model() { Text = i.ToString() });
}
_collectionView.ItemsSource = lines;
var stack = new StackLayout();
stack.Children.Add(instructions);
stack.Children.Add(button1);
stack.Children.Add(button2);
stack.Children.Add(_collectionView);
Content = stack;
}
void OnButton1Clicked(object sender, EventArgs e)
{
_collectionView.ItemTemplate = CreateDataGridTemplate(2);
}
void OnButton2Clicked(object sender, EventArgs e)
{
_collectionView.ItemTemplate = CreateDataGridTemplate(3);
}
DataTemplate CreateDataGridTemplate(int columns)
{
DataTemplate template = new DataTemplate(() =>
{
var grid = new Grid() { Padding = new Thickness(0), Margin = 0, RowSpacing = 0, ColumnSpacing = 0 };
grid.RowDefinitions.Clear();
grid.ColumnDefinitions.Clear();
grid.Children.Clear();
grid.RowDefinitions.Add(new RowDefinition() { Height = 40 });
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
Label cell;
cell = new Label() { };
cell.SetBinding(Label.TextProperty, "Text");
cell.FontSize = 20;
cell.FontAttributes = FontAttributes.Bold;
cell.BackgroundColor = Color.LightBlue;
grid.Children.Add(cell, 0, 0);
for (int i = 0; i < columns; i++)
{
grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
cell = new Label() { };
cell.Text = "Col:" + i;
cell.FontAttributes = FontAttributes.Bold;
cell.BackgroundColor = Color.Beige;
grid.Children.Add(cell, i + 1, 0);
}
return grid;
});
return template;
}
}
[Preserve(AllMembers = true)]
public class Issue7395Model
{
public string Text { get; set; }
}
}

Просмотреть файл

@ -57,10 +57,13 @@ namespace Xamarin.Forms.Controls.Issues
}
}
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 7525, "Carousel Position property doesn't change the position on page constructor", PlatformAffected.Android)]
public partial class Issue7525 : TestContentPage
{
#if APP
private int _position;
public Issue7525()
@ -81,6 +84,10 @@ namespace Xamarin.Forms.Controls.Issues
BindingContext = this;
}
}
#else
protected override void Init()
{
}
#endif
}
}

Просмотреть файл

@ -27,9 +27,11 @@ namespace Xamarin.Forms.Controls.Issues
{
Title = "Refresh View Tests";
var scrollViewContent =
new StackLayout();
new StackLayout()
{
};
Enumerable.Range(0, 1000).Select(_ => new Label() { Text = "Pull me down to refresh me" })
Enumerable.Range(0, 10).Select(_ => new Label() { HeightRequest = 200, Text = "Pull me down to refresh me" })
.ForEach(x => scrollViewContent.Children.Add(x));
_refreshView = new RefreshView()
@ -38,7 +40,8 @@ namespace Xamarin.Forms.Controls.Issues
{
HeightRequest = 2000,
BackgroundColor = Color.Green,
Content = scrollViewContent
Content = scrollViewContent,
AutomationId = "LayoutContainer"
},
Command = new Command(async () =>
{
@ -69,5 +72,31 @@ namespace Xamarin.Forms.Controls.Issues
}
};
}
#if UITEST
[Test]
public void IsRefreshingAndCommandTest()
{
RunningApp.Tap(q => q.Button("Toggle Refresh"));
RunningApp.WaitForElement(q => q.Marked("IsRefreshing: True"));
RunningApp.Screenshot("Refreshing");
RunningApp.WaitForElement(q => q.Marked("IsRefreshing: False"));
RunningApp.Screenshot("Refreshed");
}
[Test]
public void IsRefreshingAndCommandTest_SwipeDown()
{
RunningApp.WaitForElement(q => q.Marked("IsRefreshing: False"));
var container = RunningApp.WaitForElement("LayoutContainer")[0];
RunningApp.Pan(new Drag(container.Rect, Drag.Direction.TopToBottom, Drag.DragLength.Medium));
RunningApp.WaitForElement(q => q.Marked("IsRefreshing: True"));
RunningApp.Screenshot("Refreshing");
RunningApp.WaitForElement(q => q.Marked("IsRefreshing: False"));
RunningApp.Screenshot("Refreshed");
}
#endif
}
}

Просмотреть файл

@ -19,6 +19,9 @@
<Compile Include="$(MSBuildThisFileDirectory)CollectionViewHeaderFooterView.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CollectionViewItemsUpdatingScrollMode.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue3475.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue5354.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue7621.xaml.cs">
<SubType>Code</SubType>
</Compile>
@ -1054,6 +1057,8 @@
<Compile Include="$(MSBuildThisFileDirectory)Issue5503.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LabelTextType.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ShellTitleView.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue5159.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7311.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7053.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue6894.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue6929.cs" />
@ -1063,6 +1068,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue7525.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7395.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7582.cs" />
</ItemGroup>
<ItemGroup>
@ -1384,6 +1390,9 @@
<Compile Update="C:\Users\hartez\Documents\Xamarin\Xamarin.Forms\Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Issue7519Xaml.xaml.cs">
<DependentUpon>Issue7519Xaml.xaml</DependentUpon>
</Compile>
<Compile Update="$(MSBuildThisFileDirectory)Issue5354.xaml.cs">
<DependentUpon>Issue5354.xaml</DependentUpon>
</Compile>
<Compile Update="$(MSBuildThisFileDirectory)Issue7621.xaml.cs">
<DependentUpon>Issue7621.xaml</DependentUpon>
</Compile>
@ -1430,4 +1439,10 @@
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
</Project>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue5354.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
</Project>

Просмотреть файл

@ -145,7 +145,7 @@ namespace Xamarin.Forms.Controls.GalleryPages.CollectionViewGalleries.CarouselVi
var labelDragging = new Label { Text = nameof(carouselView.IsDragging) };
var switchDragging = new Switch();
switchDragging.SetBinding(Switch.IsToggledProperty, nameof(carouselView.IsDragging));
switchDragging.SetBinding(Switch.IsToggledProperty, nameof(carouselView.IsDragging), BindingMode.OneWay);
stacklayoutInfo.Children.Add(labelDragging);
stacklayoutInfo.Children.Add(switchDragging);

Просмотреть файл

@ -57,4 +57,4 @@
public const string RefreshView = "RefreshView";
public const string TitleView = "TitleView";
}
}
}

Просмотреть файл

@ -78,8 +78,8 @@ namespace Xamarin.Forms.Core.UnitTests
Assert.True(calledFromMainThread, "Action not invoked from main thread.");
Assert.False(invoked, "Action invoked early.");
var aggregateEx = Assert.Throws<AggregateException>(() => task.Wait(100));
Assert.IsInstanceOf<ApplicationException>(aggregateEx.InnerException);
async Task MethodThatThrows() => await task;
Assert.ThrowsAsync<ApplicationException>(MethodThatThrows);
Assert.True(invoked, "Action not invoked.");
}

Просмотреть файл

@ -20,7 +20,7 @@ namespace Xamarin.Forms
}
public static readonly BindableProperty IsRefreshingProperty =
BindableProperty.Create(nameof(IsRefreshing), typeof(bool), typeof(RefreshView), false);
BindableProperty.Create(nameof(IsRefreshing), typeof(bool), typeof(RefreshView), false, BindingMode.TwoWay);
public bool IsRefreshing
{

Просмотреть файл

@ -5,31 +5,24 @@ using Xamarin.Forms.Xaml;
namespace Xamarin.Forms
{
[Xaml.ProvideCompiled("Xamarin.Forms.Core.XamlC.TypeTypeConverter")]
[Xaml.TypeConversion(typeof(Type))]
[ProvideCompiled("Xamarin.Forms.Core.XamlC.TypeTypeConverter")]
[TypeConversion(typeof(Type))]
public sealed class TypeTypeConverter : TypeConverter, IExtendedTypeConverter
{
[Obsolete("IExtendedTypeConverter.ConvertFrom is obsolete as of version 2.2.0. Please use ConvertFromInvariantString (string, IServiceProvider) instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
object IExtendedTypeConverter.ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider)
{
return ((IExtendedTypeConverter)this).ConvertFromInvariantString((string)value, serviceProvider);
}
object IExtendedTypeConverter.ConvertFromInvariantString(string value, IServiceProvider serviceProvider)
{
if (serviceProvider == null)
throw new ArgumentNullException("serviceProvider");
var typeResolver = serviceProvider.GetService(typeof(IXamlTypeResolver)) as IXamlTypeResolver;
if (typeResolver == null)
throw new ArgumentNullException(nameof(serviceProvider));
if (!(serviceProvider.GetService(typeof(IXamlTypeResolver)) is IXamlTypeResolver typeResolver))
throw new ArgumentException("No IXamlTypeResolver in IServiceProvider");
return typeResolver.Resolve(value, serviceProvider);
}
public override object ConvertFromInvariantString(string value)
{
throw new NotImplementedException();
}
public override object ConvertFromInvariantString(string value) => throw new NotImplementedException();
[Obsolete("IExtendedTypeConverter.ConvertFrom is obsolete as of version 2.2.0. Please use ConvertFromInvariantString (string, IServiceProvider) instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
object IExtendedTypeConverter.ConvertFrom(CultureInfo culture, object value, IServiceProvider serviceProvider) => ((IExtendedTypeConverter)this).ConvertFromInvariantString((string)value, serviceProvider);
}
}

Просмотреть файл

@ -11,8 +11,9 @@
<AssemblyName>Xamarin.Forms.Maps.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<SkipMicrosoftUIXamlCheckTargetPlatformVersion>true</SkipMicrosoftUIXamlCheckTargetPlatformVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Просмотреть файл

@ -93,7 +93,12 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
base.OnFocusChangeRequested(sender, e);
if (e.Focus)
CallOnClick();
{
if (Clickable)
CallOnClick();
else
((IPickerRenderer)this)?.OnClick();
}
else if (_dialog != null)
{
_dialog.Hide();

Просмотреть файл

@ -213,6 +213,10 @@ namespace Xamarin.Forms.Platform.Android
{
UpdateItemsSource();
}
else if (changedProperty.Is(Xamarin.Forms.ItemsView.ItemTemplateProperty))
{
UpdateAdapter();
}
else if (changedProperty.Is(VisualElement.BackgroundColorProperty))
{
UpdateBackgroundColor();
@ -221,7 +225,7 @@ namespace Xamarin.Forms.Platform.Android
{
UpdateFlowDirection();
}
else if (changedProperty.IsOneOf(Xamarin.Forms.ItemsView.EmptyViewProperty,
else if (changedProperty.IsOneOf(Xamarin.Forms.ItemsView.EmptyViewProperty,
Xamarin.Forms.ItemsView.EmptyViewTemplateProperty))
{
UpdateEmptyView();
@ -276,7 +280,10 @@ namespace Xamarin.Forms.Platform.Android
ItemsViewAdapter = CreateAdapter();
if (GetAdapter() != _emptyViewAdapter)
{
SetAdapter(null);
SwapAdapter(ItemsViewAdapter, true);
}
oldItemViewAdapter?.Dispose();
}
@ -591,6 +598,15 @@ namespace Xamarin.Forms.Platform.Android
}
}
protected virtual void UpdateLayoutManager()
{
ItemsLayout = GetItemsLayout();
SetLayoutManager(SelectLayoutManager(ItemsLayout));
UpdateFlowDirection();
UpdateItemSpacing();
}
internal void UpdateEmptyViewVisibility()
{
if (ItemsViewAdapter == null)
@ -600,18 +616,18 @@ namespace Xamarin.Forms.Platform.Android
var showEmptyView = ItemsView?.EmptyView != null && ItemsViewAdapter.ItemCount == 0;
Adapter currAdapter = GetAdapter();
if (showEmptyView && currAdapter != _emptyViewAdapter)
var currentAdapter = GetAdapter();
if (showEmptyView && currentAdapter != _emptyViewAdapter)
{
SwapAdapter(_emptyViewAdapter, true);
// TODO hartez 2018/10/24 17:34:36 If this works, cache this layout manager as _emptyLayoutManager
SetLayoutManager(new LinearLayoutManager(Context));
}
else if (!showEmptyView && currAdapter != ItemsViewAdapter)
else if (!showEmptyView && currentAdapter != ItemsViewAdapter)
{
SwapAdapter(ItemsViewAdapter, true);
SetLayoutManager(SelectLayoutManager(ItemsLayout));
UpdateLayoutManager();
}
}

Просмотреть файл

@ -1,4 +1,5 @@
using Android.Content;
using System.ComponentModel;
using Android.Content;
namespace Xamarin.Forms.Platform.Android
{
@ -13,6 +14,16 @@ namespace Xamarin.Forms.Platform.Android
{
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs changedProperty)
{
base.OnElementPropertyChanged(sender, changedProperty);
if (changedProperty.Is(StructuredItemsView.ItemsLayoutProperty))
{
UpdateLayoutManager();
}
}
protected override TAdapter CreateAdapter()
{
return (TAdapter)new StructuredItemsViewAdapter<TItemsView, TItemsViewSource>(ItemsView);

Просмотреть файл

@ -10,8 +10,8 @@ namespace Xamarin.Forms.Platform.Android
{
internal static class PickerManager
{
readonly static HashSet<Keycode> availableKeys = new HashSet<Keycode>(new[] {
Keycode.Tab, Keycode.Forward, Keycode.Back, Keycode.DpadDown, Keycode.DpadLeft, Keycode.DpadRight, Keycode.DpadUp
readonly static HashSet<Keycode> AvailableKeys = new HashSet<Keycode>(new[] {
Keycode.Tab, Keycode.Forward, Keycode.DpadDown, Keycode.DpadLeft, Keycode.DpadRight, Keycode.DpadUp
});
public static void Init(EditText editText)
@ -42,7 +42,7 @@ namespace Xamarin.Forms.Platform.Android
static void OnKeyPress(object sender, AView.KeyEventArgs e)
{
if (!availableKeys.Contains(e.KeyCode))
if (!AvailableKeys.Contains(e.KeyCode))
{
e.Handled = false;
return;

Просмотреть файл

@ -97,7 +97,12 @@ namespace Xamarin.Forms.Platform.Android
base.OnFocusChangeRequested(sender, e);
if (e.Focus)
CallOnClick();
{
if (Clickable)
CallOnClick();
else
((IPickerRenderer)this)?.OnClick();
}
else if (_dialog != null)
{
_dialog.Hide();

Просмотреть файл

@ -107,7 +107,12 @@ namespace Xamarin.Forms.Platform.Android
base.OnFocusChangeRequested(sender, e);
if (e.Focus)
CallOnClick();
{
if (Clickable)
CallOnClick();
else
((IPickerRenderer)this)?.OnClick();
}
else if (_dialog != null)
{
_dialog.Hide();
@ -122,7 +127,7 @@ namespace Xamarin.Forms.Platform.Android
if (_dialog != null)
return;
var picker = new NumberPicker(Context);
if (model.Items != null && model.Items.Any())
{

Просмотреть файл

@ -54,10 +54,10 @@ namespace Xamarin.Forms.Platform.Android
if (RefreshView != null && RefreshView.IsRefreshing != _refreshing)
RefreshView.IsRefreshing = _refreshing;
if (base.Refreshing == _refreshing)
return;
base.Refreshing = _refreshing;
if (base.Refreshing && Element is RefreshView refreshView && refreshView.Command != null && refreshView.Command.CanExecute(refreshView?.CommandParameter))
refreshView.Command.Execute(refreshView?.CommandParameter);
}
}
@ -186,10 +186,7 @@ namespace Xamarin.Forms.Platform.Android
public void OnRefresh()
{
if (RefreshView?.Command?.CanExecute(RefreshView?.CommandParameter) ?? false)
{
RefreshView.Command.Execute(RefreshView?.CommandParameter);
}
Refreshing = true;
}
void HandlePropertyChanged(object sender, PropertyChangedEventArgs e)

Просмотреть файл

@ -16,6 +16,7 @@ namespace Xamarin.Forms.Platform.Android
{
int _originalHintTextColor;
AlertDialog _dialog;
bool _isDisposed;
bool Is24HourView
{
@ -89,7 +90,12 @@ namespace Xamarin.Forms.Platform.Android
base.OnFocusChangeRequested(sender, e);
if (e.Focus)
CallOnClick();
{
if (Clickable)
CallOnClick();
else
((IPickerRenderer)this)?.OnClick();
}
else if (_dialog != null)
{
_dialog.Hide();
@ -98,6 +104,7 @@ namespace Xamarin.Forms.Platform.Android
if (Forms.IsLollipopOrNewer)
_dialog.CancelEvent -= OnCancelButtonClicked;
_dialog?.Dispose();
_dialog = null;
}
}
@ -112,6 +119,25 @@ namespace Xamarin.Forms.Platform.Android
return dialog;
}
protected override void Dispose(bool disposing)
{
if (_isDisposed)
return;
_isDisposed = true;
if (disposing)
{
if (Forms.IsLollipopOrNewer && _dialog.IsAlive())
_dialog.CancelEvent -= OnCancelButtonClicked;
_dialog?.Dispose();
_dialog = null;
}
base.Dispose(disposing);
}
void IPickerRenderer.OnClick()
{
if (_dialog != null && _dialog.IsShowing)

Просмотреть файл

@ -2,7 +2,8 @@
{
internal class ItemTemplateContext
{
public ItemTemplateContext(DataTemplate formsDataTemplate, object item, BindableObject container, double? height = null, double? width = null, Thickness? itemSpacing = null)
public ItemTemplateContext(DataTemplate formsDataTemplate, object item, BindableObject container,
double? height = null, double? width = null, Thickness? itemSpacing = null)
{
FormsDataTemplate = formsDataTemplate;
Item = item;

Просмотреть файл

@ -0,0 +1,39 @@
using System.Collections;
namespace Xamarin.Forms.Platform.UWP
{
internal class ItemTemplateContextEnumerable : IEnumerable
{
readonly IEnumerable _itemsSource;
readonly DataTemplate _formsDataTemplate;
readonly BindableObject _container;
readonly double _itemHeight;
readonly double _itemWidth;
readonly Thickness _itemSpacing;
public ItemTemplateContextEnumerable(IEnumerable itemsSource, DataTemplate formsDataTemplate, BindableObject container,
double? itemHeight = null, double? itemWidth = null, Thickness? itemSpacing = null)
{
_itemsSource = itemsSource;
_formsDataTemplate = formsDataTemplate;
_container = container;
if (itemHeight.HasValue)
_itemHeight = itemHeight.Value;
if (itemWidth.HasValue)
_itemWidth = itemWidth.Value;
if (itemSpacing.HasValue)
_itemSpacing = itemSpacing.Value;
}
public IEnumerator GetEnumerator()
{
foreach (var item in _itemsSource)
{
yield return new ItemTemplateContext(_formsDataTemplate, item, _container, _itemHeight, _itemWidth, _itemSpacing);
}
}
}
}

Просмотреть файл

@ -0,0 +1,101 @@
using System.Collections;
using System.Collections.Generic;
namespace Xamarin.Forms.Platform.UWP
{
internal class ItemTemplateContextList : IReadOnlyList<ItemTemplateContext>
{
readonly IList _itemsSource;
readonly DataTemplate _itemTemplate;
readonly BindableObject _container;
readonly double _itemHeight;
readonly double _itemWidth;
readonly Thickness _itemSpacing;
readonly List<ItemTemplateContext> _itemTemplateContexts;
public int Count => _itemsSource.Count;
public ItemTemplateContext this[int index]
{
get
{
if (_itemTemplateContexts[index] == null)
{
_itemTemplateContexts[index] = new ItemTemplateContext(_itemTemplate, _itemsSource[index],
_container, _itemHeight, _itemWidth, _itemSpacing);
}
return _itemTemplateContexts[index];
}
}
public ItemTemplateContextList(IList itemsSource, DataTemplate itemTemplate, BindableObject container,
double? itemHeight = null, double? itemWidth = null, Thickness? itemSpacing = null)
{
_itemsSource = itemsSource;
_itemTemplate = itemTemplate;
_container = container;
if (itemHeight.HasValue)
_itemHeight = itemHeight.Value;
if (itemWidth.HasValue)
_itemWidth = itemWidth.Value;
if (itemSpacing.HasValue)
_itemSpacing = itemSpacing.Value;
_itemTemplateContexts = new List<ItemTemplateContext>(_itemsSource.Count);
for (int n = 0; n < _itemsSource.Count; n++)
{
_itemTemplateContexts.Add(null);
}
}
public IEnumerator<ItemTemplateContext> GetEnumerator()
{
return new ItemTemplateContextListEnumerator(this);
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
internal class ItemTemplateContextListEnumerator : IEnumerator<ItemTemplateContext>
{
public ItemTemplateContext Current { get; private set; }
object IEnumerator.Current { get; }
int _currentIndex = -1;
private ItemTemplateContextList _itemTemplateContextList;
public ItemTemplateContextListEnumerator(ItemTemplateContextList observableItemTemplateCollection) =>
_itemTemplateContextList = observableItemTemplateCollection;
public void Dispose()
{
}
public bool MoveNext()
{
if (_currentIndex >= _itemTemplateContextList.Count - 1)
{
return false;
}
_currentIndex += 1;
Current = _itemTemplateContextList[_currentIndex];
return true;
}
public void Reset()
{
Current = null;
_currentIndex = -1;
}
}
}
}

Просмотреть файл

@ -1,54 +0,0 @@
using System.Collections;
namespace Xamarin.Forms.Platform.UWP
{
internal class ItemTemplateEnumerator : IEnumerable, IEnumerator
{
readonly DataTemplate _formsDataTemplate;
readonly IEnumerator _innerEnumerator;
readonly BindableObject _container;
readonly double _itemHeight;
readonly double _itemWidth;
readonly Thickness _itemSpacing;
public ItemTemplateEnumerator(IEnumerable itemsSource, DataTemplate formsDataTemplate, BindableObject container, double? itemHeight = null, double? itemWidth = null, Thickness? itemSpacing = null)
{
_formsDataTemplate = formsDataTemplate;
_container = container;
_innerEnumerator = itemsSource.GetEnumerator();
if (itemHeight.HasValue)
_itemHeight = itemHeight.Value;
if (itemWidth.HasValue)
_itemWidth = itemWidth.Value;
if (itemSpacing.HasValue)
_itemSpacing = itemSpacing.Value;
}
public IEnumerator GetEnumerator()
{
return this;
}
public bool MoveNext()
{
var moveNext = _innerEnumerator.MoveNext();
if (moveNext)
{
Current = new ItemTemplateContext(_formsDataTemplate, _innerEnumerator.Current, _container, _itemHeight, _itemWidth, _itemSpacing);
}
return moveNext;
}
public void Reset()
{
_innerEnumerator.Reset();
}
public object Current { get; private set; }
}
}

Просмотреть файл

@ -89,7 +89,13 @@ namespace Xamarin.Forms.Platform.UWP
incc.CollectionChanged -= ItemsChanged;
}
if (_collectionViewSource != null)
{
_collectionViewSource.Source = null;
}
_collectionViewSource = null;
ListViewBase.ItemsSource = null;
return;
}
@ -124,7 +130,7 @@ namespace Xamarin.Forms.Platform.UWP
IsSourceGrouped = false
};
}
ListViewBase.ItemsSource = _collectionViewSource.View;
UpdateEmptyViewVisibility();
@ -197,6 +203,17 @@ namespace Xamarin.Forms.Platform.UWP
// Stop listening for ScrollTo requests
oldElement.ScrollToRequested -= ScrollToRequested;
if (ListViewBase != null)
{
ListViewBase.ItemsSource = null;
}
if (_collectionViewSource != null)
{
_collectionViewSource.Source = null;
}
}
void UpdateVerticalScrollBarVisibility()

Просмотреть файл

@ -15,7 +15,8 @@ namespace Xamarin.Forms.Platform.UWP
readonly Thickness _itemSpacing;
readonly INotifyCollectionChanged _notifyCollectionChanged;
public ObservableItemTemplateCollection(IList itemsSource, DataTemplate itemTemplate, BindableObject container, double? itemHeight = null, double? itemWidth = null, Thickness? itemSpacing = null)
public ObservableItemTemplateCollection(IList itemsSource, DataTemplate itemTemplate, BindableObject container,
double? itemHeight = null, double? itemWidth = null, Thickness? itemSpacing = null)
{
if (!(itemsSource is INotifyCollectionChanged notifyCollectionChanged))
{
@ -39,6 +40,9 @@ namespace Xamarin.Forms.Platform.UWP
for (int n = 0; n < itemsSource.Count; n++)
{
// We're using this as a source for a ListViewBase, and we need INCC to work. So ListViewBase is going
// to iterate over the entire source list right off the bat, no matter what we do. Creating one
// ItemTemplateContext per item in the collection is unavoidable. Luckily, ITC is pretty cheap.
Add(new ItemTemplateContext(itemTemplate, itemsSource[n], container, _itemHeight, _itemWidth, _itemSpacing));
}

Просмотреть файл

@ -9,11 +9,13 @@ namespace Xamarin.Forms.Platform.UWP
{
switch (itemsSource)
{
case IList list when itemsSource is INotifyCollectionChanged:
return new ObservableItemTemplateCollection(list, itemTemplate, container, itemHeight, itemWidth, itemSpacing);
case IList observable when itemsSource is INotifyCollectionChanged:
return new ObservableItemTemplateCollection(observable, itemTemplate, container, itemHeight, itemWidth, itemSpacing);
case IList list:
return new ItemTemplateContextList(list, itemTemplate, container, itemHeight, itemWidth, itemSpacing);
}
return new ItemTemplateEnumerator(itemsSource, itemTemplate, container, itemHeight, itemWidth, itemSpacing);
return new ItemTemplateContextEnumerable(itemsSource, itemTemplate, container, itemHeight, itemWidth, itemSpacing);
}
}
}

Просмотреть файл

@ -11,8 +11,9 @@
<AssemblyName>Xamarin.Forms.Platform.UAP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<SkipMicrosoftUIXamlCheckTargetPlatformVersion>true</SkipMicrosoftUIXamlCheckTargetPlatformVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@ -44,6 +45,7 @@
<Compile Include="CollectionView\FormsListView.cs" />
<Compile Include="CollectionView\IEmptyView.cs" />
<Compile Include="CollectionView\ItemsViewRenderer.cs" />
<Compile Include="CollectionView\ItemTemplateContextList.cs" />
<Compile Include="CollectionView\ScrollHelpers.cs" />
<Compile Include="CollectionView\SelectableItemsViewRenderer.cs" />
<Compile Include="CollectionView\StructuredItemsViewRenderer.cs" />
@ -77,7 +79,7 @@
<Compile Include="ITitleIconProvider.cs" />
<Compile Include="ITitleViewProvider.cs" />
<Compile Include="CollectionView\FormsGridView.cs" />
<Compile Include="CollectionView\ItemTemplateEnumerator.cs" />
<Compile Include="CollectionView\ItemTemplateContextEnumerable.cs" />
<Compile Include="CollectionView\ItemTemplateContext.cs" />
<Compile Include="ITitleProvider.cs" />
<Compile Include="ITitleViewRendererController.cs" />
@ -295,7 +297,7 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<SDKReference Include="WindowsMobile, Version=10.0.18362.0">
<SDKReference Include="WindowsMobile, Version=10.0.16299.0">
<Name>Windows Mobile Extensions for the UWP</Name>
</SDKReference>
</ItemGroup>

Просмотреть файл

@ -24,6 +24,10 @@ namespace Xamarin.Forms.Platform.iOS
{
StructuredItemsViewController.UpdateFooterView();
}
else if (changedProperty.Is(StructuredItemsView.ItemsLayoutProperty))
{
StructuredItemsViewController.UpdateLayout(SelectLayout());
}
}
protected override void SetUpNewElement(ItemsView newElement)
@ -42,14 +46,14 @@ namespace Xamarin.Forms.Platform.iOS
protected override ItemsViewLayout SelectLayout()
{
var itemSizingStrategy = StructuredItemsView.ItemSizingStrategy;
var layoutSpecification = StructuredItemsView.ItemsLayout;
var itemsLayout = StructuredItemsView.ItemsLayout;
if (layoutSpecification is GridItemsLayout gridItemsLayout)
if (itemsLayout is GridItemsLayout gridItemsLayout)
{
return new GridViewLayout(gridItemsLayout, itemSizingStrategy);
}
if (layoutSpecification is LinearItemsLayout listItemsLayout)
if (itemsLayout is LinearItemsLayout listItemsLayout)
{
return new ListViewLayout(listItemsLayout, itemSizingStrategy);
}

Просмотреть файл

@ -22,8 +22,16 @@ namespace Xamarin.Forms.Platform.iOS
{
_isRefreshing = value;
if (Element != null && Element.IsRefreshing != _isRefreshing)
Element.IsRefreshing = _isRefreshing;
if (_isRefreshing)
{
_refreshControl.BeginRefreshing();
if (Element is RefreshView refreshView && refreshView.Command != null && refreshView.Command.CanExecute(refreshView?.CommandParameter))
refreshView.Command.Execute(refreshView?.CommandParameter);
}
else
_refreshControl.EndRefreshing();
@ -201,10 +209,7 @@ namespace Xamarin.Forms.Platform.iOS
void OnRefresh(object sender, EventArgs e)
{
if (Element?.Command?.CanExecute(Element?.CommandParameter) ?? false)
{
Element.Command.Execute(Element?.CommandParameter);
}
IsRefreshing = true;
}
void IEffectControlProvider.RegisterEffect(Effect effect)

Просмотреть файл

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="using:Xamarin.Forms.Xaml.UnitTests">
<Color x:Key="AccentColor">#FF4B14</Color>
<Color x:Key="BlackOpacityColor">#99253748</Color>
<Color x:Key="BlackTextColor">#253748</Color>
@ -19,4 +20,8 @@
<Color x:Key="DarkBackgroundColor">#C0C0C0</Color>
<Color x:Key="MediumGrayTextColor">#4d4d4d</Color>
<Color x:Key="LightTextColor">#999999</Color>
<Style TargetType="local:Gh7531" x:Key="style">
<Setter Property="BackgroundColor" Value="HotPink"/>
</Style>
</ResourceDictionary>

Просмотреть файл

@ -2,7 +2,9 @@
<?xaml-comp compile="true" ?>
<ResourceDictionary
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="using:Xamarin.Forms.Xaml.UnitTests">
<Color x:Key="AccentColor">#FF4B14</Color>
<Color x:Key="BlackOpacityColor">#99253748</Color>
<Color x:Key="BlackTextColor">#253748</Color>
@ -20,4 +22,8 @@
<Color x:Key="DarkBackgroundColor">#C0C0C0</Color>
<Color x:Key="MediumGrayTextColor">#4d4d4d</Color>
<Color x:Key="LightTextColor">#999999</Color>
<Style TargetType="local:Gh7531" x:Key="style">
<Setter Property="BackgroundColor" Value="HotPink"/>
</Style>
</ResourceDictionary>

Просмотреть файл

@ -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.Gh7531">
<ContentPage.Resources>
<ResourceDictionary Source="../AppResources/Colors.xaml" x:Key="Colors" />
<ResourceDictionary Source="../AppResources/CompiledColors.xaml" x:Key="CompiledColors" />
</ContentPage.Resources>
</ContentPage>

Просмотреть файл

@ -0,0 +1,32 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using NUnit.Framework;
using Xamarin.Forms.Core.UnitTests;
namespace Xamarin.Forms.Xaml.UnitTests
{
public partial class Gh7531 : ContentPage
{
public Gh7531() => InitializeComponent();
public Gh7531(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;
[Test]
public void XamlOnlyResourceResolvesLocalAssembly([Values(false, true)]bool useCompiledXaml)
{
Gh7531 layout = null;
Assert.DoesNotThrow(() => layout = new Gh7531(useCompiledXaml));
var style = ((ResourceDictionary)layout.Resources["Colors"])["style"] as Style;
Assert.That(style.TargetType, Is.EqualTo(typeof(Gh7531)));
}
}
}
}

Просмотреть файл

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Xamarin.Forms.Xaml
{
@ -16,5 +17,6 @@ namespace Xamarin.Forms.Xaml
public HydrationContext ParentContext { get; set; }
public Action<Exception> ExceptionHandler { get; set; }
public object RootElement { get; set; }
public Assembly RootAssembly { get; internal set; }
}
}

Просмотреть файл

@ -32,7 +32,7 @@ namespace Xamarin.Forms.Xaml
if (stream == null)
throw new XamlParseException($"No resource found for '{resourceId}'.", lineInfo);
using (var reader = new StreamReader(stream)) {
rd.LoadFromXaml(reader.ReadToEnd());
rd.LoadFromXaml(reader.ReadToEnd(), assembly);
return rd;
}
}

Просмотреть файл

@ -26,6 +26,7 @@
// THE SOFTWARE.
using System;
using System.Reflection;
namespace Xamarin.Forms.Xaml
{
@ -42,5 +43,11 @@ namespace Xamarin.Forms.Xaml
XamlLoader.Load(view, xaml);
return view;
}
internal static TXaml LoadFromXaml<TXaml>(this TXaml view, string xaml, Assembly rootAssembly)
{
XamlLoader.Load(view, xaml, rootAssembly);
return view;
}
}
}

Просмотреть файл

@ -71,8 +71,10 @@ namespace Xamarin.Forms.Xaml
}
public static void Load(object view, string xaml) => Load(view, xaml, false);
public static void Load(object view, string xaml, bool useDesignProperties) => Load(view, xaml, null, useDesignProperties);
public static void Load(object view, string xaml, Assembly rootAssembly) => Load(view, xaml, rootAssembly, false);
public static void Load(object view, string xaml, bool useDesignProperties)
public static void Load(object view, string xaml, Assembly rootAssembly, bool useDesignProperties)
{
using (var textReader = new StringReader(xaml))
using (var reader = XmlReader.Create(textReader)) {
@ -95,7 +97,7 @@ namespace Xamarin.Forms.Xaml
void ehandler(Exception e) => ResourceLoader.ExceptionHandler2?.Invoke((e, XamlFilePathAttribute.GetFilePathForObject(view)));
Visit(rootnode, new HydrationContext {
RootElement = view,
RootAssembly = rootAssembly ?? view.GetType().GetTypeInfo().Assembly,
ExceptionHandler = doNotThrow ? ehandler : (Action<Exception>)null
}, useDesignProperties);
break;

Просмотреть файл

@ -17,11 +17,8 @@ namespace Xamarin.Forms.Xaml.Internals
IProvideValueTarget = new XamlValueTargetProvider(targetObject, node, context, null);
if (context != null)
IRootObjectProvider = new XamlRootObjectProvider(context.RootElement);
if (context != null && node != null)
{
IXamlTypeResolver = new XamlTypeResolver(node.NamespaceResolver, XamlParser.GetElementType,
context.RootElement.GetType().GetTypeInfo().Assembly);
if (context != null && node != null) {
IXamlTypeResolver = new XamlTypeResolver(node.NamespaceResolver, XamlParser.GetElementType, context.RootAssembly);
Add(typeof(IReferenceProvider), new ReferenceProvider(node));
}
@ -31,52 +28,49 @@ namespace Xamarin.Forms.Xaml.Internals
IValueConverterProvider = new ValueConverterProvider();
}
public XamlServiceProvider()
{
IValueConverterProvider = new ValueConverterProvider();
}
public XamlServiceProvider() => IValueConverterProvider = new ValueConverterProvider();
internal IProvideValueTarget IProvideValueTarget
{
get { return (IProvideValueTarget)GetService(typeof (IProvideValueTarget)); }
set { services[typeof (IProvideValueTarget)] = value; }
get => (IProvideValueTarget)GetService(typeof(IProvideValueTarget));
set => services[typeof(IProvideValueTarget)] = value;
}
internal IXamlTypeResolver IXamlTypeResolver
{
get { return (IXamlTypeResolver)GetService(typeof (IXamlTypeResolver)); }
set { services[typeof (IXamlTypeResolver)] = value; }
get => (IXamlTypeResolver)GetService(typeof(IXamlTypeResolver));
set => services[typeof(IXamlTypeResolver)] = value;
}
internal IRootObjectProvider IRootObjectProvider
{
get { return (IRootObjectProvider)GetService(typeof (IRootObjectProvider)); }
set { services[typeof (IRootObjectProvider)] = value; }
get => (IRootObjectProvider)GetService(typeof(IRootObjectProvider));
set => services[typeof(IRootObjectProvider)] = value;
}
internal IXmlLineInfoProvider IXmlLineInfoProvider
{
get { return (IXmlLineInfoProvider)GetService(typeof (IXmlLineInfoProvider)); }
set { services[typeof (IXmlLineInfoProvider)] = value; }
}
[Obsolete]
[EditorBrowsable(EditorBrowsableState.Never)]
internal INameScopeProvider INameScopeProvider
{
get { return (INameScopeProvider)GetService(typeof (INameScopeProvider)); }
set { services[typeof (INameScopeProvider)] = value; }
get => (IXmlLineInfoProvider)GetService(typeof(IXmlLineInfoProvider));
set => services[typeof(IXmlLineInfoProvider)] = value;
}
internal IValueConverterProvider IValueConverterProvider
{
get { return (IValueConverterProvider)GetService(typeof (IValueConverterProvider)); }
set { services[typeof (IValueConverterProvider)] = value; }
get => (IValueConverterProvider)GetService(typeof(IValueConverterProvider));
set => services[typeof(IValueConverterProvider)] = value;
}
public object GetService(Type serviceType) => services.TryGetValue(serviceType, out var service) ? service : null;
public void Add(Type type, object service) => services.Add(type, service);
[Obsolete]
[EditorBrowsable(EditorBrowsableState.Never)]
internal INameScopeProvider INameScopeProvider
{
get { return (INameScopeProvider)GetService(typeof(INameScopeProvider)); }
set { services[typeof(INameScopeProvider)] = value; }
}
}
class XamlValueTargetProvider : IProvideParentValues, IProvideValueTarget
@ -227,7 +221,7 @@ namespace Xamarin.Forms.Xaml.Internals
var namespaceuri = namespaceResolver.LookupNamespace(prefix);
if (namespaceuri == null) {
exception = new XamlParseException(string.Format("No xmlns declaration for prefix \"{0}\"", prefix), xmlLineInfo);
exception = new XamlParseException($"No xmlns declaration for prefix \"{prefix}\"", xmlLineInfo);
return null;
}
@ -239,20 +233,14 @@ namespace Xamarin.Forms.Xaml.Internals
class XamlRootObjectProvider : IRootObjectProvider
{
public XamlRootObjectProvider(object rootObject)
{
RootObject = rootObject;
}
public XamlRootObjectProvider(object rootObject) => RootObject = rootObject;
public object RootObject { get; }
}
public class XmlLineInfoProvider : IXmlLineInfoProvider
{
public XmlLineInfoProvider(IXmlLineInfo xmlLineInfo)
{
XmlLineInfo = xmlLineInfo;
}
public XmlLineInfoProvider(IXmlLineInfo xmlLineInfo) => XmlLineInfo = xmlLineInfo;
public IXmlLineInfo XmlLineInfo { get; }
}

Просмотреть файл

@ -11,14 +11,14 @@ variables:
value: Xamarin.Forms.sln
- name: BuildVersion
value: $[counter('$(Build.SourceBranchName)_counter', 1)]
- name: MONO_VERSION
value: 5_18_1
- name: XCODE_VERSION
value: 10.2
- name: NUGET_VERSION
value: 5.0.2
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: true
- name: winVmImage
value: Hosted Windows 2019 with VS2019
value: Hosted VS2017
- name: DOTNET_VERSION
value: 3.0.100
resources:
repositories:
@ -53,8 +53,8 @@ schedules:
displayName: Daily midnight build
branches:
include:
- master
- master
jobs:
- template: build/steps/build-windows.yml
parameters:
@ -65,6 +65,7 @@ jobs:
msbuildExtraArguments: '/nowarn:VSX1000 /p:CreateAllAndroidTargets=true /bl:$(Build.ArtifactStagingDirectory)\win.binlog'
buildConfiguration: $(DefaultBuildConfiguration)
buildPlatform: $(DefaultBuildPlatform)
provisionatorPath : 'build/provisioning/provisioning.csx'
- template: build/steps/build-android.yml
parameters:
@ -74,7 +75,7 @@ jobs:
targetFolder: Xamarin.Forms.ControlGallery.Android/legacyRenderers/
androidProjectArguments: '/t:"Rebuild;SignAndroidPackage" /bl:$(Build.ArtifactStagingDirectory)/android-legacy.binlog'
buildConfiguration: $(DefaultBuildConfiguration)
monoVersion : $(MONO_VERSION)
provisionatorPath : 'build/provisioning/provisioning.csx'
- template: build/steps/build-android.yml
parameters:
@ -84,7 +85,7 @@ jobs:
targetFolder: Xamarin.Forms.ControlGallery.Android/preAppCompat
androidProjectArguments: '/t:"Rebuild;SignAndroidPackage" /p:DefineConstants="TRACE DEBUG FORMS_APPLICATION_ACTIVITY APP" /bl:$(Build.ArtifactStagingDirectory)/android-preappcompact.binlog'
buildConfiguration: $(DefaultBuildConfiguration)
monoVersion : $(MONO_VERSION)
provisionatorPath : 'build/provisioning/provisioning.csx'
- template: build/steps/build-android.yml
parameters:
@ -94,7 +95,7 @@ jobs:
targetFolder: Xamarin.Forms.ControlGallery.Android/newRenderers/
androidProjectArguments: '/t:"Rebuild;SignAndroidPackage" /p:DefineConstants="TRACE DEBUG TEST_EXPERIMENTAL_RENDERERS APP" /bl:$(Build.ArtifactStagingDirectory)/android-newrenderers.binlog'
buildConfiguration: $(DefaultBuildConfiguration)
monoVersion : $(MONO_VERSION)
provisionatorPath : 'build/provisioning/provisioning.csx'
- job: osx
displayName: OSX Phase
@ -106,12 +107,10 @@ jobs:
- msbuild
- Xamarin.iOS
variables:
provisioningOSX : $(provisioning)
provisionator.osxPath : 'build/provisioning/provisioning.csx'
provisionator.signPath : 'build/provisioning/provisioning_sign.csx'
buildConfiguration: $(DefaultBuildConfiguration)
slnPath: $(SolutionFile)
nugetVersion: $(NUGET_VERSION)
iOSCertSecureFileName: 'Xamarin Forms iOS Certificate.p12'
iOSProvisioningSecureFileName: 'Xamarin Forms iOS Provisioning.mobileprovision'
monoVersion : $(MONO_VERSION)
@ -128,7 +127,6 @@ jobs:
variables:
FormsIdAppend: ''
buildConfiguration: $(DefaultBuildConfiguration)
nugetVersion: $(NUGET_VERSION)
nugetPackageVersion : $[ dependencies.win.outputs['debug.winbuild.xamarinformspackageversion'] ]
steps:
- template: build/steps/build-nuget.yml

Просмотреть файл

@ -21,6 +21,9 @@ PowerShell:
#addin "nuget:?package=Cake.Xamarin&version=3.0.0"
#addin "nuget:?package=Cake.Android.Adb&version=3.0.0"
#addin "nuget:?package=Cake.Git&version=0.19.0"
#addin "nuget:?package=Cake.Android.SdkManager&version=3.0.2"
#addin "nuget:?package=Cake.Boots&version=1.0.0.291"
//////////////////////////////////////////////////////////////////////
// TOOLS
//////////////////////////////////////////////////////////////////////
@ -40,6 +43,34 @@ var informationalVersion = gitVersion.InformationalVersion;
var buildVersion = gitVersion.FullBuildMetaData;
var nugetversion = Argument<string>("packageVersion", gitVersion.NuGetVersion);
var ANDROID_HOME = EnvironmentVariable ("ANDROID_HOME") ??
(IsRunningOnWindows () ? "C:\\Program Files (x86)\\Android\\android-sdk\\" : "");
string monoMajorVersion = "5.18.1";
string monoPatchVersion = "28";
string monoVersion = $"{monoMajorVersion}.{monoPatchVersion}";
string monoSDK_windows = $"https://download.mono-project.com/archive/{monoMajorVersion}/windows-installer/mono-{monoVersion}-x64-0.msi";
string androidSDK_windows = "https://aka.ms/xamarin-android-commercial-d15-9-windows";
string iOSSDK_windows = "https://download.visualstudio.microsoft.com/download/pr/71f33151-5db4-49cc-ac70-ba835a9f81e2/d256c6c50cd80ec0207783c5c7a4bc2f/xamarin.visualstudio.apple.sdk.4.12.3.83.vsix";
string macSDK_windows = "";
monoMajorVersion = "6.4.0";
monoPatchVersion = "198";
monoVersion = $"{monoMajorVersion}.{monoPatchVersion}";
string androidSDK_macos = "https://aka.ms/xamarin-android-commercial-d16-3-macos";
string monoSDK_macos = $"https://download.mono-project.com/archive/{monoMajorVersion}/macos-10-universal/MonoFramework-MDK-{monoVersion}.macos10.xamarin.universal.pkg";
string iOSSDK_macos = $"https://bosstoragemirror.blob.core.windows.net/wrench/jenkins/d16-3/5e8a208b5f44c4885060d95e3c3ad68d6a5e95e8/40/package/xamarin.ios-13.2.0.42.pkg";
string macSDK_macos = $"https://bosstoragemirror.blob.core.windows.net/wrench/jenkins/d16-3/5e8a208b5f44c4885060d95e3c3ad68d6a5e95e8/40/package/xamarin.mac-6.2.0.42.pkg";
string androidSDK = IsRunningOnWindows() ? androidSDK_windows : androidSDK_macos;
string monoSDK = IsRunningOnWindows() ? monoSDK_windows : monoSDK_macos;
string iosSDK = IsRunningOnWindows() ? "" : iOSSDK_macos;
string macSDK = IsRunningOnWindows() ? "" : macSDK_macos;
string[] androidSdkManagerInstalls = new string[0]; //new [] { "platforms;android-29"};
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
@ -49,9 +80,85 @@ Task("Clean")
{
CleanDirectories("./**/obj", (fsi)=> !fsi.Path.FullPath.Contains("XFCorePostProcessor") && !fsi.Path.FullPath.StartsWith("tools"));
CleanDirectories("./**/bin", (fsi)=> !fsi.Path.FullPath.Contains("XFCorePostProcessor") && !fsi.Path.FullPath.StartsWith("tools"));
});
Task("provision-macsdk")
.Does(async () =>
{
if(!IsRunningOnWindows() && !String.IsNullOrWhiteSpace(macSDK))
{
await Boots(macSDK);
}
});
Task("provision-iossdk")
.Does(async () =>
{
if(!IsRunningOnWindows())
{
if(!String.IsNullOrWhiteSpace(iosSDK))
await Boots(iosSDK);
}
});
Task("provision-androidsdk")
.Does(async () =>
{
Information ("ANDROID_HOME: {0}", ANDROID_HOME);
if(androidSdkManagerInstalls.Length > 0)
{
var androidSdkSettings = new AndroidSdkManagerToolSettings {
SdkRoot = ANDROID_HOME,
SkipVersionCheck = true
};
try { AcceptLicenses (androidSdkSettings); } catch { }
AndroidSdkManagerInstall (androidSdkManagerInstalls, androidSdkSettings);
}
if(!String.IsNullOrWhiteSpace(androidSDK))
await Boots (androidSDK);
});
Task("provision-monosdk")
.Does(async () =>
{
if(IsRunningOnWindows())
{
if(!String.IsNullOrWhiteSpace(monoSDK))
{
string monoPath = $"{System.IO.Path.GetTempPath()}mono.msi";
if(!String.IsNullOrWhiteSpace(EnvironmentVariable("Build.Repository.LocalPath")))
monoPath = EnvironmentVariable("Build.Repository.LocalPath") + "\\" + "mono.msi";
Information("Mono Path: {0}", monoPath);
Information("Mono Version: {0}", monoSDK);
DownloadFile(monoSDK, monoPath);
StartProcess("msiexec", new ProcessSettings {
Arguments = new ProcessArgumentBuilder()
.Append(@"/i")
.Append(monoPath)
.Append("/qn")
}
);
}
}
else
{
if(!String.IsNullOrWhiteSpace(monoSDK))
await Boots(monoSDK);
}
});
Task("provision")
.IsDependentOn("provision-macsdk")
.IsDependentOn("provision-iossdk")
.IsDependentOn("provision-monosdk")
.IsDependentOn("provision-androidsdk");
Task("NuGetPack")
.IsDependentOn("Build")
.IsDependentOn("_NuGetPack");

Просмотреть файл

@ -1,8 +1,77 @@
var channel = Env("CHANNEL") ?? "Stable";
string monoMajorVersion = "6.4.0";
string monoPatchVersion = "198";
string monoVersion = $"{monoMajorVersion}.{monoPatchVersion}";
string monoSDK_windows = $"https://download.mono-project.com/archive/{monoMajorVersion}/windows-installer/mono-{monoVersion}-x64-0.msi";
string androidSDK_windows = "https://download.visualstudio.microsoft.com/download/pr/1131a8f5-99f5-4326-93b1-f5827b54ecd5/e7bd0f680004131157a22982c389b05f2d3698cc04fab3901ce2d7ded47ad8e0/Xamarin.Android.Sdk-10.0.0.43.vsix";
string iOSSDK_windows = "";
string macSDK_windows = "";
string androidSDK_macos = "https://download.visualstudio.microsoft.com/download/pr/d5a432e4-09f3-4da6-9bdd-1d4fdd87f34c/c4ce0854064ffc16b957f22ccc08f9df/xamarin.android-10.0.0.43.pkg";
string monoSDK_macos = $"https://download.mono-project.com/archive/{monoMajorVersion}/macos-10-universal/MonoFramework-MDK-{monoVersion}.macos10.xamarin.universal.pkg";
string iOSSDK_macos = $"https://bosstoragemirror.blob.core.windows.net/wrench/jenkins/d16-3/5e8a208b5f44c4885060d95e3c3ad68d6a5e95e8/40/package/xamarin.ios-13.2.0.42.pkg";
string macSDK_macos = $"https://bosstoragemirror.blob.core.windows.net/wrench/jenkins/d16-3/5e8a208b5f44c4885060d95e3c3ad68d6a5e95e8/40/package/xamarin.mac-6.2.0.42.pkg";
if (IsMac)
{
Item (XreItem.Xcode_10_1_0).XcodeSelect ();
Item (XreItem.Xcode_11_1_0_rc).XcodeSelect ();
if(!String.IsNullOrEmpty(monoSDK_macos))
Item ("Mono", monoVersion)
.Source (_ => monoSDK_macos);
if(!String.IsNullOrEmpty(androidSDK_macos))
Item ("Xamarin.Android", "10.0.0.43")
.Source (_ => androidSDK_macos);
if(!String.IsNullOrEmpty(iOSSDK_macos))
Item ("Xamarin.iOS", "13.2.0.42")
.Source (_ => iOSSDK_macos);
if(!String.IsNullOrEmpty(macSDK_macos))
Item ("Xamarin.Mac", "6.2.0.42")
.Source (_ => macSDK_macos);
ForceJavaCleanup();
var dotnetVersion = System.Environment.GetEnvironmentVariable("DOTNET_VERSION");
if (!string.IsNullOrEmpty(dotnetVersion))
{
// VSTS installs into a non-default location. Let's hardcode it here because why not.
var vstsBaseInstallPath = Path.Combine (Environment.GetEnvironmentVariable ("HOME"), ".dotnet", "sdk");
var vstsInstallPath = Path.Combine (vstsBaseInstallPath, dotnetVersion);
var defaultInstallLocation = Path.Combine ("/usr/local/share/dotnet/sdk/", dotnetVersion);
if (Directory.Exists (vstsBaseInstallPath) && !Directory.Exists (vstsInstallPath))
ln (defaultInstallLocation, vstsInstallPath);
}
}
Console.WriteLine(channel);
XamarinChannel(channel);
else
{
if(!String.IsNullOrEmpty(androidSDK_windows))
Item ("Xamarin.Android", "10.0.0.43")
.Source (_ => androidSDK_windows);
if(!String.IsNullOrEmpty(iOSSDK_windows))
Item ("Xamarin.iOS", "13.2.0.42")
.Source (_ => iOSSDK_windows);
if(!String.IsNullOrEmpty(macSDK_windows))
Item ("Xamarin.Mac", "6.2.0.42")
.Source (_ => macSDK_windows);
if(!String.IsNullOrEmpty(monoSDK_windows))
Item ("Mono", monoVersion)
.Source (_ => monoSDK_windows);
}
Item(XreItem.Java_OpenJDK_1_8_0_25);
AndroidSdk ().ApiLevel((AndroidApiLevel)29);
void ln (string source, string destination)
{
Console.WriteLine ($"ln -sf {source} {destination}");
if (!Config.DryRun)
Exec ("/bin/ln", "-sf", source, destination);
}

Просмотреть файл

@ -16,6 +16,8 @@ parameters:
nugetVersion: $(NUGET_VERSION)
monoVersion: $(MONO_VERSION)
apkTargetFolder: '$(build.artifactstagingdirectory)/androidApp'
provisionatorPath: 'build/provisioning/provisioning.csx'
provisionatorExtraArguments: ''
jobs:
- job: ${{ parameters.name }}
@ -27,18 +29,47 @@ jobs:
steps:
- checkout: self
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: 'Provisionator'
condition: eq(variables['provisioning'], 'true')
inputs:
provisioning_script: ${{ parameters.provisionatorPath }}
provisioning_extra_args: ${{ parameters.provisionator.extraArguments }}
- task: Bash@3
displayName: 'Cake Provision'
condition: eq(variables['provisioning'], 'false')
inputs:
targetType: 'filePath'
filePath: 'build.sh'
arguments: --target provision
- task: DotNetCoreInstaller@0
displayName: 'Install .net core $(DOTNET_VERSION)'
condition: ne(variables['DOTNET_VERSION'], '')
inputs:
version: $(DOTNET_VERSION)
- script: |
export PATH="$PATH:/Users/vsts/.dotnet/tools"
export DOTNET_ROOT="$(dirname "$(readlink "$(command -v dotnet)")")"
dotnet new globaljson --sdk-version $(DOTNET_VERSION)
displayName: 'Add globaljson file'
condition: ne(variables['DOTNET_VERSION'], '')
- script: '/bin/bash -c "sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh ${{ parameters.monoVersion }}"'
displayName: 'Select MONO ${{ parameters.monoVersion }}'
- task: NuGetToolInstaller@0
displayName: 'Use NuGet ${{ parameters.nugetVersion }}'
displayName: 'Use NuGet'
condition: ne(variables['NUGET_VERSION'], '')
inputs:
versionSpec: ${{ parameters.nugetVersion }}
versionSpec: $(NUGET_VERSION)
- task: NuGetCommand@2
displayName: 'NuGet restore ${{ parameters.slnPath }}'
inputs:
restoreSolution: ${{ parameters.slnPath }}
restoreSolution: ${{ parameters.slnPath }}
- task: MSBuild@1
displayName: 'Build ${{ parameters.buildTaskPath }}'
@ -73,4 +104,4 @@ jobs:
displayName: 'Publish Artifact: AndroidApps'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: OSXArtifacts
ArtifactName: OSXArtifacts

Просмотреть файл

@ -22,9 +22,9 @@ steps:
failOnStandardError: false
- task: NuGetToolInstaller@0
displayName: 'Use NuGet'
displayName: 'Use NuGet: $(NUGET_VERSION)'
inputs:
versionSpec: $(nugetVersion)
versionSpec: $(NUGET_VERSION)
- task: NuGetCommand@2
displayName: 'Make NuGet Package'

Просмотреть файл

@ -2,22 +2,38 @@ steps:
- checkout: self
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: Provisionate Xamarin
condition: eq(variables['provisioningOSX'], 'true')
displayName: 'Provisionator'
condition: eq(variables['provisioning'], 'true')
inputs:
provisioning_script: $(provisionator.osxPath)
provisioning_extra_args: $(provisionator.extraArguments)
- task: Bash@3
displayName: 'Cake Provision'
condition: eq(variables['provisioning'], 'false')
inputs:
targetType: 'filePath'
filePath: 'build.sh'
arguments: --target provision
- task: DotNetCoreInstaller@0
displayName: 'Install .net core $(DOTNET_VERSION)'
condition: ne(variables['DOTNET_VERSION'], '')
inputs:
version: $(DOTNET_VERSION)
- bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
displayName: Switch to the latest Xamarin SDK
- bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
displayName: Switch to the latest Xcode
- script: |
export PATH="$PATH:/Users/vsts/.dotnet/tools"
export DOTNET_ROOT="$(dirname "$(readlink "$(command -v dotnet)")")"
dotnet new globaljson --sdk-version $(DOTNET_VERSION)
displayName: 'Add globaljson file'
condition: ne(variables['DOTNET_VERSION'], '')
- task: NuGetToolInstaller@0
displayName: 'Use NuGet'
condition: ne(variables['NUGET_VERSION'], '')
inputs:
versionSpec: $(nugetVersion)
versionSpec: $(NUGET_VERSION)
- task: NuGetCommand@2
displayName: 'NuGet restore'

Просмотреть файл

@ -12,7 +12,6 @@ parameters:
releaseBuildConfiguration : 'Release'
buildPlatform : 'any cpu'
msbuildExtraArguments : ''
nugetVersion: $(NUGET_VERSION)
artifactsTargetFolder: '$(build.artifactstagingdirectory)'
artifactsName: 'win_build'
nunitTestAdapterFolder: 'packages/NUnitTestAdapter.AnyVersion/build/'
@ -34,12 +33,34 @@ jobs:
BuildConfiguration: ${{ parameters.releaseBuildConfiguration }}
BuildPlatform: ${{ parameters.buildPlatform }}
steps:
- script: build.cmd -Target provision
displayName: 'Cake Provision'
condition: eq(variables['provisioning'], 'false')
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: 'Provisionator'
condition: eq(variables['provisioning'], 'true')
inputs:
provisioning_script: ${{ parameters.provisionatorPath }}
provisioning_extra_args: ${{ parameters.provisionator.extraArguments }}
#- task: DotNetCoreInstaller@0
# displayName: "Install .net core $(DOTNET_VERSION)"
# condition: ne(variables['DOTNET_VERSION'], '')
# inputs:
# version: $(DOTNET_VERSION)
#- script: |
# dotnet new globaljson --sdk-version $(DOTNET_VERSION)
# displayName: 'Add globaljson file'
# condition: ne(variables['DOTNET_VERSION'], '')
- task: NuGetToolInstaller@0
displayName: 'Use NuGet ${{ parameters.nugetVersion }}'
displayName: 'Use NuGet $(NUGET_VERSION)'
condition: ne(variables['NUGET_VERSION'], '')
inputs:
versionSpec: ${{ parameters.nugetVersion }}
versionSpec: $(NUGET_VERSION)
- task: NuGetCommand@2
displayName: 'NuGet restore ${{ parameters.slnPath }}'
inputs: