Example #1
0
 // Token: 0x06004E7F RID: 20095 RVA: 0x00161124 File Offset: 0x0015F324
 private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (!e.IsASubPropertyChange)
     {
         Image       image        = (Image)d;
         ImageSource imageSource  = (ImageSource)e.OldValue;
         ImageSource imageSource2 = (ImageSource)e.NewValue;
         Image.UpdateBaseUri(d, imageSource2);
         image.DetachBitmapSourceEvents();
         BitmapSource bitmapSource = imageSource2 as BitmapSource;
         if (bitmapSource != null && bitmapSource.CheckAccess() && !bitmapSource.IsFrozen)
         {
             image.AttachBitmapSourceEvents(bitmapSource);
         }
     }
 }
Example #2
0
        // Token: 0x06004E77 RID: 20087 RVA: 0x00160E44 File Offset: 0x0015F044
        private Size MeasureArrangeHelper(Size inputSize)
        {
            ImageSource source = this.Source;
            Size        size   = default(Size);

            if (source == null)
            {
                return(size);
            }
            try
            {
                Image.UpdateBaseUri(this, source);
                size = source.Size;
            }
            catch (Exception errorException)
            {
                base.SetCurrentValue(Image.SourceProperty, null);
                base.RaiseEvent(new ExceptionRoutedEventArgs(Image.ImageFailedEvent, this, errorException));
            }
            Size size2 = Viewbox.ComputeScaleFactor(inputSize, size, this.Stretch, this.StretchDirection);

            return(new Size(size.Width * size2.Width, size.Height * size2.Height));
        }