summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls
diff options
context:
space:
mode:
authorPaul DiPietro <paul.dipietro@me.com>2016-04-11 16:50:28 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-04-11 16:50:28 (GMT)
commitb2ad3e53a8ae03536cf9071b0bd5d0207ee2f10c (patch)
tree227d1614c84e3d2dbe7f6231276955a6a174ff6d /Xamarin.Forms.Controls
parentc0468f1cc33fc4dc415c3a3ca4dc71986b04fc9c (diff)
downloadxamarin-forms-b2ad3e53a8ae03536cf9071b0bd5d0207ee2f10c.zip
xamarin-forms-b2ad3e53a8ae03536cf9071b0bd5d0207ee2f10c.tar.gz
xamarin-forms-b2ad3e53a8ae03536cf9071b0bd5d0207ee2f10c.tar.bz2
Enable CS0618 warnings as errors (#72)
CS0618 occurs when using an obsolete property or method. https://msdn.microsoft.com/en-us/library/x5ye6x1e.aspx
Diffstat (limited to 'Xamarin.Forms.Controls')
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs17
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/GroupedListContactsGallery.cs2
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs36
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ListViewDemoPage.cs10
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/NavigationBarGallery.cs2
-rw-r--r--Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj6
6 files changed, 70 insertions, 3 deletions
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs
index 9043c70..d29878b 100644
--- a/Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/LabelCoreGalleryPage.cs
@@ -18,12 +18,29 @@ namespace Xamarin.Forms.Controls
{
base.Build (stackLayout);
+#pragma warning disable 618
var namedSizeMediumBoldContainer = new ViewContainer<Label> (Test.Label.FontAttibutesBold, new Label { Text = "Medium Bold Font", Font = Font.SystemFontOfSize (NamedSize.Medium, FontAttributes.Bold) });
+#pragma warning restore 618
+
+#pragma warning disable 618
var namedSizeMediumItalicContainer = new ViewContainer<Label> (Test.Label.FontAttributesItalic, new Label { Text = "Medium Italic Font", Font = Font.SystemFontOfSize (NamedSize.Medium, FontAttributes.Italic) });
+#pragma warning restore 618
+
+#pragma warning disable 618
var namedSizeLargeContainer = new ViewContainer<Label> (Test.Label.FontNamedSizeLarge, new Label { Text = "Large Font", Font = Font.SystemFontOfSize (NamedSize.Large) });
+#pragma warning restore 618
+
+#pragma warning disable 618
var namedSizeMediumContainer = new ViewContainer<Label> (Test.Label.FontNamedSizeMedium, new Label { Text = "Medium Font", Font = Font.SystemFontOfSize (NamedSize.Medium) });
+#pragma warning restore 618
+
+#pragma warning disable 618
var namedSizeMicroContainer = new ViewContainer<Label> (Test.Label.FontNamedSizeMicro, new Label { Text = "Micro Font", Font = Font.SystemFontOfSize (NamedSize.Micro) });
+#pragma warning restore 618
+
+#pragma warning disable 618
var namedSizeSmallContainer = new ViewContainer<Label> (Test.Label.FontNamedSizeSmall, new Label { Text = "Small Font", Font = Font.SystemFontOfSize (NamedSize.Small) });
+#pragma warning restore 618
var formattedString = new FormattedString ();
formattedString.Spans.Add (new Span { BackgroundColor = Color.Red, ForegroundColor = Color.Olive, Text = "Span 1 " });
diff --git a/Xamarin.Forms.Controls/GalleryPages/GroupedListContactsGallery.cs b/Xamarin.Forms.Controls/GalleryPages/GroupedListContactsGallery.cs
index 1058b69..68115f9 100644
--- a/Xamarin.Forms.Controls/GalleryPages/GroupedListContactsGallery.cs
+++ b/Xamarin.Forms.Controls/GalleryPages/GroupedListContactsGallery.cs
@@ -41,7 +41,9 @@ namespace Xamarin.Forms.Controls
Label name = new Label();
name.SetBinding (Label.TextProperty, "FullName");
+#pragma warning disable 618
Label title = new Label { Font = Font.SystemFontOfSize (NamedSize.Micro) };
+#pragma warning restore 618
title.SetBinding (Label.TextProperty, "Title");
return new ViewCell { View = new StackLayout {
diff --git a/Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs b/Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs
index 6521096..c40d7ae 100644
--- a/Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs
+++ b/Xamarin.Forms.Controls/GalleryPages/LabelGallery.cs
@@ -36,32 +36,68 @@ namespace Xamarin.Forms.Controls
};
var formatted = new Label { FormattedText = new FormattedString {
Spans = {
+#pragma warning disable 618
new Span {Text="FormattedStrings ", ForegroundColor=Color.Blue, BackgroundColor = Color.Yellow, Font = Font.BoldSystemFontOfSize (NamedSize.Large)},
+#pragma warning restore 618
new Span {Text="are ", ForegroundColor=Color.Red, BackgroundColor = Color.Gray},
new Span {Text="not pretty!", ForegroundColor = Color.Green,},
}
} };
var missingfont = new Label { Text = "Missing font: use default" };
+#pragma warning disable 618
micro.Font = Font.SystemFontOfSize (NamedSize.Micro);
+#pragma warning restore 618
+
+#pragma warning disable 618
small.Font = Font.SystemFontOfSize (NamedSize.Small);
+#pragma warning restore 618
+
+#pragma warning disable 618
medium.Font = Font.SystemFontOfSize (NamedSize.Medium);
+#pragma warning restore 618
+
+#pragma warning disable 618
large.Font = Font.SystemFontOfSize (NamedSize.Large);
+#pragma warning restore 618
+#pragma warning disable 618
bold.Font = Font.SystemFontOfSize (NamedSize.Medium, FontAttributes.Bold);
+#pragma warning restore 618
+
+#pragma warning disable 618
italic.Font = Font.SystemFontOfSize (NamedSize.Medium, FontAttributes.Italic);
+#pragma warning restore 618
+
+#pragma warning disable 618
bolditalic.Font = Font.SystemFontOfSize (NamedSize.Medium, FontAttributes.Bold | FontAttributes.Italic);
+#pragma warning restore 618
var fontName = Device.OnPlatform ("Georgia", "sans-serif-light", "Comic Sans MS");
var font = Font.OfSize (fontName, NamedSize.Medium);
+#pragma warning disable 618
customFont.Font = font;
+#pragma warning restore 618
+
+#pragma warning disable 618
italicfont.Font = font.WithAttributes (FontAttributes.Italic);
+#pragma warning restore 618
+
+#pragma warning disable 618
boldfont.Font = font.WithAttributes (FontAttributes.Bold);
+#pragma warning restore 618
+
+#pragma warning disable 618
bolditalicfont.Font = font.WithAttributes (FontAttributes.Bold | FontAttributes.Italic);
+#pragma warning restore 618
+#pragma warning disable 618
customFont.GestureRecognizers.Add (new TapGestureRecognizer{Command = new Command (o => customFont.Font = Font.Default)});
+#pragma warning restore 618
+#pragma warning disable 618
missingfont.Font = Font.OfSize ("FooBar", 20);
+#pragma warning restore 618
center.HorizontalTextAlignment = TextAlignment.Center;
right.HorizontalTextAlignment = TextAlignment.End;
int i = 1;
diff --git a/Xamarin.Forms.Controls/GalleryPages/ListViewDemoPage.cs b/Xamarin.Forms.Controls/GalleryPages/ListViewDemoPage.cs
index a30ec17..370fb6d 100644
--- a/Xamarin.Forms.Controls/GalleryPages/ListViewDemoPage.cs
+++ b/Xamarin.Forms.Controls/GalleryPages/ListViewDemoPage.cs
@@ -125,7 +125,9 @@ namespace Xamarin.Forms.Controls
Label header = new Label
{
Text = "ListView",
+#pragma warning disable 618
Font = Font.BoldSystemFontOfSize(50),
+#pragma warning restore 618
HorizontalOptions = LayoutOptions.Center
};
@@ -135,7 +137,9 @@ namespace Xamarin.Forms.Controls
new Person("Abigail", new DateTime(1975, 1, 15), Color.Aqua),
new Person("Bob", new DateTime(1976, 2, 20), Color.Black),
new Person("Cathy", new DateTime(1977, 3, 10), Color.Blue),
+#pragma warning disable 618
new Person("David", new DateTime(1978, 4, 25), Color.Fuschia),
+#pragma warning restore 618
new Person("Eugenie", new DateTime(1979, 5, 5), Color.Gray),
new Person("Freddie", new DateTime(1980, 6, 30), Color.Green),
new Person("Greta", new DateTime(1981, 7, 15), Color.Lime),
@@ -150,7 +154,9 @@ namespace Xamarin.Forms.Controls
new Person("Pendleton", new DateTime(1978, 4, 10), Color.Yellow),
new Person("Queenie", new DateTime(1979, 5, 15), Color.Aqua),
new Person("Rob", new DateTime(1980, 6, 30), Color.Blue),
+#pragma warning disable 618
new Person("Sally", new DateTime(1981, 7, 5), Color.Fuschia),
+#pragma warning restore 618
new Person("Timothy", new DateTime(1982, 8, 30), Color.Green),
new Person("Uma", new DateTime(1983, 9, 10), Color.Lime),
new Person("Victor", new DateTime(1984, 10, 20), Color.Maroon),
@@ -164,7 +170,9 @@ namespace Xamarin.Forms.Controls
new Person("Abigail", new DateTime(1975, 1, 15), Color.Aqua),
new Person("Bob", new DateTime(1976, 2, 20), Color.Black),
new Person("Cathy", new DateTime(1977, 3, 10), Color.Blue),
+#pragma warning disable 618
new Person("David", new DateTime(1978, 4, 25), Color.Fuschia),
+#pragma warning restore 618
new Person("Eugenie", new DateTime(1979, 5, 5), Color.Gray),
new Person("Freddie", new DateTime(1980, 6, 30), Color.Green),
new Person("Greta", new DateTime(1981, 7, 15), Color.Lime),
@@ -179,7 +187,9 @@ namespace Xamarin.Forms.Controls
new Person("Pendleton", new DateTime(1978, 4, 10), Color.Yellow),
new Person("Queenie", new DateTime(1979, 5, 15), Color.Aqua),
new Person("Rob", new DateTime(1980, 6, 30), Color.Blue),
+#pragma warning disable 618
new Person("Sally", new DateTime(1981, 7, 5), Color.Fuschia),
+#pragma warning restore 618
new Person("Timothy", new DateTime(1982, 8, 30), Color.Green),
new Person("Uma", new DateTime(1983, 9, 10), Color.Lime),
new Person("Victor", new DateTime(1984, 10, 20), Color.Maroon),
diff --git a/Xamarin.Forms.Controls/GalleryPages/NavigationBarGallery.cs b/Xamarin.Forms.Controls/GalleryPages/NavigationBarGallery.cs
index dfbc342..e571539 100644
--- a/Xamarin.Forms.Controls/GalleryPages/NavigationBarGallery.cs
+++ b/Xamarin.Forms.Controls/GalleryPages/NavigationBarGallery.cs
@@ -45,7 +45,9 @@ namespace Xamarin.Forms.Controls
new Button {
Text = "Make sure Tint still works",
Command = new Command (() => {
+#pragma warning disable 618
rootNavPage.Tint = Color.Red;
+#pragma warning restore 618
})
},
new Button {
diff --git a/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj b/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
index e653509..05a7b5f 100644
--- a/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
+++ b/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
@@ -28,7 +28,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>0114;0108;0109;4014;1998;0649;0618;0169;0472;0414;0168;0219;0429</NoWarn>
+ <NoWarn>0114;0108;0109;4014;1998;0649;0169;0472;0414;0168;0219;0429</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -38,7 +38,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>0114;0108;0109;4014;1998;0649;0618;0169;0472;0414;0168;0219;0429</NoWarn>
+ <NoWarn>0114;0108;0109;4014;1998;0649;0169;0472;0414;0168;0219;0429</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
@@ -51,7 +51,7 @@
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <NoWarn>0114;0108;0109;4014;1998;0649;0618;0169;0472;0414;0168;0219;0429</NoWarn>
+ <NoWarn>0114;0108;0109;4014;1998;0649;0169;0472;0414;0168;0219;0429</NoWarn>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->