Fix compiler warnings in WPF platform project (#6616)

This commit is contained in:
Eilon Lipton 2019-06-24 15:10:17 -07:00 коммит произвёл Samantha Houts
Родитель 62dfadabf2
Коммит 63f61b12ef
5 изменённых файлов: 12 добавлений и 8 удалений

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

@ -15,22 +15,22 @@ namespace Xamarin.Forms.Platform.WPF
{
const string PropertyStoreFile = "PropertyStore.forms";
public async Task<IDictionary<string, object>> DeserializePropertiesAsync()
public Task<IDictionary<string, object>> DeserializePropertiesAsync()
{
IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);
if (!isoStore.FileExists(PropertyStoreFile))
return new Dictionary<string, object>(4);
return Task.FromResult<IDictionary<string, object>>(new Dictionary<string, object>(4));
using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(PropertyStoreFile, FileMode.Open, isoStore))
{
if (stream.Length == 0)
return new Dictionary<string, object>(4);
return Task.FromResult<IDictionary<string, object>>(new Dictionary<string, object>(4));
try
{
var serializer = new DataContractSerializer(typeof(IDictionary<string, object>));
return (IDictionary<string, object>)serializer.ReadObject(stream);
return Task.FromResult((IDictionary<string, object>)serializer.ReadObject(stream));
}
catch (Exception e)
{
@ -38,7 +38,7 @@ namespace Xamarin.Forms.Platform.WPF
Log.Warning("Xamarin.Forms PropertyStore", $"Exception while reading Application properties: {e}");
}
return null;
return Task.FromResult<IDictionary<string, object>>(null);
}
}

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

@ -145,7 +145,7 @@ namespace Xamarin.Forms.Platform.WPF
public sealed class UriImageSourceHandler : IImageSourceHandler
{
public async Task<System.Windows.Media.ImageSource> LoadImageAsync(ImageSource imagesoure, CancellationToken cancelationToken = new CancellationToken())
public Task<System.Windows.Media.ImageSource> LoadImageAsync(ImageSource imagesoure, CancellationToken cancelationToken = new CancellationToken())
{
BitmapImage bitmapimage = null;
var imageLoader = imagesoure as UriImageSource;
@ -156,7 +156,7 @@ namespace Xamarin.Forms.Platform.WPF
bitmapimage.UriSource = imageLoader.Uri;
bitmapimage.EndInit();
}
return bitmapimage;
return Task.FromResult<System.Windows.Media.ImageSource>(bitmapimage);
}
}
}

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

@ -63,7 +63,7 @@ namespace Xamarin.Forms.Platform.WPF
UpdateVerticalScrollBarVisibility();
if (Element.SelectedItem != null)
OnElementItemSelected(null, new SelectedItemChangedEventArgs(Element.SelectedItem));
OnElementItemSelected(null, new SelectedItemChangedEventArgs(Element.SelectedItem, -1));
}
base.OnElementChanged(e);

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

@ -30,7 +30,9 @@ namespace Xamarin.Forms.Platform.WPF
bool _invalidateArrangeNeeded;
bool _isPanning;
#pragma warning disable 0414 // The private field 'field' is assigned but its value is never used
bool _isPinching;
#pragma warning restore 0414
bool _touchFrameReportedEventSet;
int _touchPoints = 1;

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

@ -11,7 +11,9 @@ namespace Xamarin.Forms.Platform.WPF
internal class WPFDeviceInfo : DeviceInfo
{
internal const string BWPorientationChangedName = "Xamarin.WPF.OrientationChanged";
#pragma warning disable 0649 // Field 'field' is never assigned to, and will always have its default value 'value'
readonly double _scalingFactor;
#pragma warning restore 0649
public WPFDeviceInfo()
{