Пример #1
0
 static void LoadSource(GifImage control, Uri source)
 {
     if (source == null)
     {
         control.Source = null;
     }
     else
     {
         control.gf = new GifBitmapDecoder(source, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
         control.anim = new Int32Animation(0, control.gf.Frames.Count - 1, new Duration(new TimeSpan(0, 0, 0, control.gf.Frames.Count / 10, (int)((control.gf.Frames.Count / 10.0 - control.gf.Frames.Count / 10) * 1000))));
         control.anim.RepeatBehavior = RepeatBehavior.Forever;
         control.Source = control.gf.Frames[0];
     }
 }