diff options
17 files changed, 60 insertions, 18 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla22229.xaml.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla22229.xaml.cs index f7d8918c..12e7143f 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla22229.xaml.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla22229.xaml.cs @@ -26,7 +26,8 @@ namespace Xamarin.Forms.Controls case Device.Android: _prefix = ""; break; - case Device.Windows: + case Device.WinRT: + case Device.UWP: case Device.WinPhone: _prefix = "Assets/"; break; diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34632.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34632.cs index 30cbc5a8..201f0b86 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34632.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34632.cs @@ -16,7 +16,7 @@ namespace Xamarin.Forms.Controls.Issues { protected override void Init () { - if (Device.RuntimePlatform == Device.Windows) + if (Device.RuntimePlatform == Device.UWP || Device.RuntimePlatform == Device.WinRT) MasterBehavior = MasterBehavior.Split; else MasterBehavior = MasterBehavior.SplitOnLandscape; diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla42069.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla42069.cs index d4de5aa3..b1622328 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla42069.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla42069.cs @@ -25,7 +25,8 @@ namespace Xamarin.Forms.Controls smallImage = "coffee.png"; break; case Device.WinPhone: - case Device.Windows: + case Device.WinRT: + case Device.UWP: smallImage = "bank.png"; break; } diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/ImageLoadingErrorHandling.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/ImageLoadingErrorHandling.cs index 6abac885..b2607c71 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/ImageLoadingErrorHandling.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/ImageLoadingErrorHandling.cs @@ -5,7 +5,7 @@ using Xamarin.Forms.Internals; namespace Xamarin.Forms.Controls { [Preserve(AllMembers = true)] - [Issue(IssueTracker.None, 0, "Image Loading Error Handling", PlatformAffected.WinRT)] + [Issue(IssueTracker.None, 0, "Image Loading Error Handling", PlatformAffected.WinRT | PlatformAffected.UWP)] public class ImageLoadingErrorHandling : TestContentPage { protected override void Init() @@ -31,7 +31,7 @@ namespace Xamarin.Forms.Controls Grid fakeUri = CreateTest(() => image.Source = ImageSource.FromUri(new Uri("http://not.real")), "Non-existent URI", - Device.RuntimePlatform == Device.Windows && Device.Idiom == TargetIdiom.Phone + (Device.RuntimePlatform == Device.UWP || Device.RuntimePlatform == Device.WinRT) && Device.Idiom == TargetIdiom.Phone ? "Clicking this button should display an alert dialog. The error message should include the text 'NotFound'." : "Clicking this button should display an alert dialog. The error message should include the text 'the server name or address could not be resolved'."); diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue773.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue773.cs index 63d9cbc1..78570518 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue773.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue773.cs @@ -165,7 +165,7 @@ namespace Xamarin.Forms.Controls.Issues layout.Children.Add(new ScrollView { BackgroundColor = Color.Aqua, Orientation = ScrollOrientation.Horizontal, - HeightRequest = Device.RuntimePlatform == Device.Windows || Device.RuntimePlatform == Device.WinPhone ? 80 : 44, + HeightRequest = Device.RuntimePlatform == Device.WinRT || Device.RuntimePlatform == Device.UWP || Device.RuntimePlatform == Device.WinPhone ? 80 : 44, Content = buttonStack }); diff --git a/Xamarin.Forms.Controls/ControlGalleryPages/AccessibilityGallery.cs b/Xamarin.Forms.Controls/ControlGalleryPages/AccessibilityGallery.cs index 64d9e2a2..f5f0b39c 100644 --- a/Xamarin.Forms.Controls/ControlGalleryPages/AccessibilityGallery.cs +++ b/Xamarin.Forms.Controls/ControlGalleryPages/AccessibilityGallery.cs @@ -41,7 +41,8 @@ namespace Xamarin.Forms.Controls imageInstructions = $"The following Image should read aloud \"{ImageName}. {ImageHint}\". You should be able to tap the image and hear an alert box."; boxInstructions = $"The following Box should read aloud \"{BoxName}. {BoxHint}\". You should be able to tap the box and hear an alert box."; break; - case Device.Windows: + case Device.WinRT: + case Device.UWP: case Device.WinPhone: screenReader = "Narrator"; scrollFingers = "two fingers"; diff --git a/Xamarin.Forms.Controls/GalleryPages/ButtonGallery.cs b/Xamarin.Forms.Controls/GalleryPages/ButtonGallery.cs index 896085a3..3d452f71 100644 --- a/Xamarin.Forms.Controls/GalleryPages/ButtonGallery.cs +++ b/Xamarin.Forms.Controls/GalleryPages/ButtonGallery.cs @@ -41,7 +41,8 @@ namespace Xamarin.Forms.Controls fontName = "sans-serif-light"; break; case Device.WinPhone: - case Device.Windows: + case Device.WinRT: + case Device.UWP: fontName = "Comic Sans MS"; break; } diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ProductViewCell.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ProductViewCell.cs index e0b4b9df..92f36810 100644 --- a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ProductViewCell.cs +++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ProductViewCell.cs @@ -20,7 +20,7 @@ namespace Xamarin.Forms.Controls var frame = new Frame { Content = _stack, - BackgroundColor = new[] { Device.Android, Device.Windows, Device.WinPhone }.Contains(Device.RuntimePlatform) ? new Color(0.2) : new Color(1) + BackgroundColor = new[] { Device.Android, Device.WinRT, Device.UWP, Device.WinPhone }.Contains(Device.RuntimePlatform) ? new Color(0.2) : new Color(1) }; _timeLabel = new Label { Text = text diff --git a/Xamarin.Forms.Controls/GalleryPages/FrameGallery.cs b/Xamarin.Forms.Controls/GalleryPages/FrameGallery.cs index 653ecdae..96078f5b 100644 --- a/Xamarin.Forms.Controls/GalleryPages/FrameGallery.cs +++ b/Xamarin.Forms.Controls/GalleryPages/FrameGallery.cs @@ -22,7 +22,7 @@ namespace Xamarin.Forms.Controls Content = new Button { Text = "Framous!" }, - BackgroundColor = new[] { Device.Android, Device.Windows, Device.WinPhone }.Contains(Device.RuntimePlatform) ? new Color(0) : new Color(1), + BackgroundColor = new[] { Device.Android, Device.WinRT, Device.UWP, Device.WinPhone }.Contains(Device.RuntimePlatform) ? new Color(0) : new Color(1), VerticalOptions = LayoutOptions.FillAndExpand }; diff --git a/Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs b/Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs index 4ae44ba6..d141ca4a 100644 --- a/Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs +++ b/Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs @@ -82,7 +82,8 @@ namespace Xamarin.Forms.Controls fontName = "sans-serif-light"; break; case Device.WinPhone: - case Device.Windows: + case Device.WinRT: + case Device.UWP: fontName = "Comic Sans MS"; break; } diff --git a/Xamarin.Forms.Controls/TestCases.cs b/Xamarin.Forms.Controls/TestCases.cs index d05b0a0e..85f766f2 100644 --- a/Xamarin.Forms.Controls/TestCases.cs +++ b/Xamarin.Forms.Controls/TestCases.cs @@ -212,7 +212,8 @@ namespace Xamarin.Forms.Controls page.Title = "Test Cases"; break; case Device.WinPhone: - case Device.Windows: + case Device.UWP: + case Device.WinRT: page.Title = "Tests"; break; } diff --git a/Xamarin.Forms.Core.UnitTests/ListViewTests.cs b/Xamarin.Forms.Core.UnitTests/ListViewTests.cs index 329ba86c..9b2810ed 100644 --- a/Xamarin.Forms.Core.UnitTests/ListViewTests.cs +++ b/Xamarin.Forms.Core.UnitTests/ListViewTests.cs @@ -1474,7 +1474,8 @@ namespace Xamarin.Forms.Core.UnitTests [TestCase (Device.Android, ListViewCachingStrategy.RecycleElement)] [TestCase (Device.iOS, ListViewCachingStrategy.RecycleElement)] - [TestCase (Device.Windows, ListViewCachingStrategy.RetainElement)] + [TestCase (Device.WinRT, ListViewCachingStrategy.RetainElement)] + [TestCase(Device.UWP, ListViewCachingStrategy.RetainElement)] [TestCase ("Other", ListViewCachingStrategy.RetainElement)] [TestCase (Device.WinPhone, ListViewCachingStrategy.RetainElement)] public void EnforcesCachingStrategy (string platform, ListViewCachingStrategy expected) diff --git a/Xamarin.Forms.Core/Device.cs b/Xamarin.Forms.Core/Device.cs index ba83ca0e..755a8e2d 100644 --- a/Xamarin.Forms.Core/Device.cs +++ b/Xamarin.Forms.Core/Device.cs @@ -11,7 +11,8 @@ namespace Xamarin.Forms public const string iOS = "iOS"; public const string Android = "Android"; public const string WinPhone = "WinPhone"; - public const string Windows = "Windows"; + public const string UWP = "UWP"; + public const string WinRT = "WinRT"; public const string macOS = "macOS"; internal static DeviceInfo info; @@ -29,6 +30,13 @@ namespace Xamarin.Forms TargetPlatform platform; if (Enum.TryParse(RuntimePlatform, out platform)) return platform; + + // In the old TargetPlatform, there was no distinction between WinRT/UWP + if (RuntimePlatform == UWP || RuntimePlatform == WinRT) + { + return TargetPlatform.Windows; + } + return TargetPlatform.Other; } } diff --git a/Xamarin.Forms.CustomAttributes/TestAttributes.cs b/Xamarin.Forms.CustomAttributes/TestAttributes.cs index 3ac2e6f2..bebd78ac 100644 --- a/Xamarin.Forms.CustomAttributes/TestAttributes.cs +++ b/Xamarin.Forms.CustomAttributes/TestAttributes.cs @@ -135,6 +135,7 @@ namespace Xamarin.Forms.CustomAttributes Android = 1 << 1, WinPhone = 1 << 2, WinRT = 1 << 3, + UWP = 1 << 4, All = ~0, Default = 0 } diff --git a/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs b/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs index 3b5999f6..ced37977 100644 --- a/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs +++ b/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs @@ -116,7 +116,11 @@ namespace Xamarin.Forms.Platform.WinRT public bool IsInvokeRequired => !CoreApplication.MainView.CoreWindow.Dispatcher.HasThreadAccess; - public string RuntimePlatform => Device.Windows; +#if WINDOWS_UWP + public string RuntimePlatform => Device.UWP; +#else + public string RuntimePlatform => Device.WinRT; +#endif public void OpenUriAction(Uri uri) { diff --git a/Xamarin.Forms.Xaml/XamlParser.cs b/Xamarin.Forms.Xaml/XamlParser.cs index 456aad6a..eb078597 100644 --- a/Xamarin.Forms.Xaml/XamlParser.cs +++ b/Xamarin.Forms.Xaml/XamlParser.cs @@ -269,7 +269,14 @@ namespace Xamarin.Forms.Xaml continue; try { if (targetPlatform != Device.RuntimePlatform) + { + // Special case for Windows backward compatibility + if (targetPlatform == "Windows" && + (Device.RuntimePlatform == Device.UWP || Device.RuntimePlatform == Device.WinRT)) + continue; + prefixes.Add(prefix); + } } catch (InvalidOperationException) { prefixes.Add(prefix); } diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml index 37fbad36..fbf294b3 100644 --- a/docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml @@ -361,9 +361,9 @@ button.HeightRequest = Device.OnPlatform (20,30,30); <remarks>While the callback returns <see langword="true" />, the timer will keep recurring.</remarks> </Docs> </Member> - <Member MemberName="Windows"> - <MemberSignature Language="C#" Value="public const string Windows;" /> - <MemberSignature Language="ILAsm" Value=".field public static literal string Windows" /> + <Member MemberName="UWP"> + <MemberSignature Language="C#" Value="public const string UWP;" /> + <MemberSignature Language="ILAsm" Value=".field public static literal string UWP" /> <MemberType>Field</MemberType> <AssemblyInfo> <AssemblyVersion>2.0.0.0</AssemblyVersion> @@ -391,5 +391,20 @@ button.HeightRequest = Device.OnPlatform (20,30,30); <remarks>To be added.</remarks> </Docs> </Member> + <Member MemberName="WinRT"> + <MemberSignature Language="C#" Value="public const string WinRT;" /> + <MemberSignature Language="ILAsm" Value=".field public static literal string WinRT" /> + <MemberType>Field</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.String</ReturnType> + </ReturnValue> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> </Members> </Type> |