mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-04 14:08:32 +00:00
Use C# 7
This commit is contained in:
parent
3ffb613f80
commit
310f0cca9a
21 changed files with 51 additions and 86 deletions
|
|
@ -160,9 +160,8 @@ namespace MapControl.Caching
|
|||
throw new ArgumentNullException("The parameter key must not be null.");
|
||||
}
|
||||
|
||||
var imageCacheItem = value as ImageCacheItem;
|
||||
|
||||
if (imageCacheItem == null)
|
||||
if (!(value is ImageCacheItem imageCacheItem))
|
||||
{
|
||||
throw new ArgumentException("The parameter value must be a MapControl.Caching.ImageCacheItem instance.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,16 +35,14 @@ namespace MapControl
|
|||
|
||||
protected void DataCollectionPropertyChanged(DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
INotifyCollectionChanged collection;
|
||||
|
||||
if ((collection = e.OldValue as INotifyCollectionChanged) != null)
|
||||
if (e.OldValue is INotifyCollectionChanged oldCollection)
|
||||
{
|
||||
CollectionChangedEventManager.RemoveListener(collection, this);
|
||||
CollectionChangedEventManager.RemoveListener(oldCollection, this);
|
||||
}
|
||||
|
||||
if ((collection = e.NewValue as INotifyCollectionChanged) != null)
|
||||
if (e.NewValue is INotifyCollectionChanged newCollection)
|
||||
{
|
||||
CollectionChangedEventManager.AddListener(collection, this);
|
||||
CollectionChangedEventManager.AddListener(newCollection, this);
|
||||
}
|
||||
|
||||
UpdateData();
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@ namespace MapControl
|
|||
|
||||
if (fadeIn && FadeDuration > TimeSpan.Zero)
|
||||
{
|
||||
var bitmap = image as BitmapSource;
|
||||
|
||||
if (bitmap != null && !bitmap.IsFrozen && bitmap.IsDownloading)
|
||||
if (image is BitmapSource bitmap && !bitmap.IsFrozen && bitmap.IsDownloading)
|
||||
{
|
||||
bitmap.DownloadCompleted += BitmapDownloadCompleted;
|
||||
bitmap.DownloadFailed += BitmapDownloadFailed;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue