mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-07 07:25:21 +00:00
Use C# 7
This commit is contained in:
parent
3ffb613f80
commit
310f0cca9a
21 changed files with 51 additions and 86 deletions
|
|
@ -17,12 +17,7 @@ namespace MapControl.Caching
|
|||
|
||||
public ImageFileCache(StorageFolder folder)
|
||||
{
|
||||
if (folder == null)
|
||||
{
|
||||
throw new ArgumentNullException("The parameter rootFolder must not be null.");
|
||||
}
|
||||
|
||||
this.folder = folder;
|
||||
this.folder = folder ?? throw new ArgumentNullException("The parameter rootFolder must not be null.");
|
||||
|
||||
Debug.WriteLine("Created ImageFileCache in " + folder.Path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,12 +53,9 @@ namespace MapControl
|
|||
|
||||
private static MapBase FindParentMap(FrameworkElement element)
|
||||
{
|
||||
var parent = VisualTreeHelper.GetParent(element) as FrameworkElement;
|
||||
|
||||
return parent == null ? null
|
||||
: ((parent as MapBase)
|
||||
?? (MapBase)element.GetValue(ParentMapProperty)
|
||||
?? FindParentMap(parent));
|
||||
return VisualTreeHelper.GetParent(element) is FrameworkElement parent
|
||||
? ((parent as MapBase) ?? (MapBase)element.GetValue(ParentMapProperty) ?? FindParentMap(parent))
|
||||
: null;
|
||||
}
|
||||
|
||||
private static void SetViewPosition(FrameworkElement element, Point? viewPosition)
|
||||
|
|
|
|||
|
|
@ -21,16 +21,14 @@ namespace MapControl
|
|||
|
||||
protected void DataCollectionPropertyChanged(DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
INotifyCollectionChanged collection;
|
||||
|
||||
if ((collection = e.OldValue as INotifyCollectionChanged) != null)
|
||||
if (e.OldValue is INotifyCollectionChanged oldCollection)
|
||||
{
|
||||
collection.CollectionChanged -= DataCollectionChanged;
|
||||
oldCollection.CollectionChanged -= DataCollectionChanged;
|
||||
}
|
||||
|
||||
if ((collection = e.NewValue as INotifyCollectionChanged) != null)
|
||||
if (e.NewValue is INotifyCollectionChanged newCollection)
|
||||
{
|
||||
collection.CollectionChanged += DataCollectionChanged;
|
||||
newCollection.CollectionChanged += DataCollectionChanged;
|
||||
}
|
||||
|
||||
UpdateData();
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@ namespace MapControl
|
|||
|
||||
if (fadeIn && FadeDuration > TimeSpan.Zero)
|
||||
{
|
||||
var bitmap = image as BitmapImage;
|
||||
|
||||
if (bitmap?.UriSource != null)
|
||||
if (image is BitmapImage bitmap && bitmap.UriSource != null)
|
||||
{
|
||||
bitmap.ImageOpened += BitmapImageOpened;
|
||||
bitmap.ImageFailed += BitmapImageFailed;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue