Beispiel #1
0
 private async void SetSourceUri(Uri uri)
 {
     _currentUri = uri;
     if (uri.IsAbsoluteUri)
     {
         var cachedUri = uri;
         if (uri.Scheme == "http" || uri.Scheme == "https")
         {
             SetProgress();
             _isHttpSource = true;
             if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
             {
                 cachedUri = await BitmapCache.GetImageUriAsync(uri, (int)_currentSize.Width, (int)_currentSize.Height);
             }
         }
         if (Path.GetExtension(uri.LocalPath).Equals(".gif", StringComparison.OrdinalIgnoreCase))
         {
             this.SetImageGif(cachedUri);
         }
         else
         {
             this.SetImage(new BitmapImage(cachedUri));
         }
     }
     else
     {
         ClearImage();
         ClearImageGif();
     }
 }
Beispiel #2
0
 private async void RefreshSourceUri(Uri uri)
 {
     if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
     {
         uri = await BitmapCache.GetImageUriAsync(uri, (int)_currentSize.Width, (int)_currentSize.Height);
     }
     this.SetImage(new BitmapImage(uri));
 }
Beispiel #3
0
 private async void RefreshSourceUri(Uri uri)
 {
     try
     {
         if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
         {
             uri = await BitmapCache.GetImageUriAsync(uri, (int)_currentSize.Width, (int)_currentSize.Height);
         }
         if (uri != null)
         {
             this.SetImage(new BitmapImage(uri));
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("RefreshSourceUri. {0}", ex.Message);
     }
 }