/// <summary> /// 属性更改处理事件 /// </summary> private static void OnSourcePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { AnimatedGIF gif = sender as AnimatedGIF; if (gif == null) { return; } if (!gif.IsLoaded) { return; } BindSource(gif); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 38 "..\..\..\..\Page\Page_Image.xaml" ((Util.Controls.FButton)(target)).Click += new System.Windows.RoutedEventHandler(this.FButton_Click); #line default #line hidden return; case 2: this.ImageCache = ((Util.Controls.ThumbnailImage)(target)); return; case 3: this.Gif = ((Util.Controls.AnimatedGIF)(target)); return; case 4: this.gifSource = ((System.Windows.Controls.TextBox)(target)); return; case 5: #line 44 "..\..\..\..\Page\Page_Image.xaml" ((Util.Controls.FButton)(target)).Click += new System.Windows.RoutedEventHandler(this.FButton_StartClick); #line default #line hidden return; case 6: #line 45 "..\..\..\..\Page\Page_Image.xaml" ((Util.Controls.FButton)(target)).Click += new System.Windows.RoutedEventHandler(this.FButton_EndClick); #line default #line hidden return; } this._contentLoaded = true; }
private static void BindSource(AnimatedGIF gif) { gif.StopAnimate(); if (gif.Bitmap != null) { gif.Bitmap.Dispose(); } var path = gif.GIFSource; if (path.IsInvalid()) { return; } if (!Path.IsPathRooted(path)) { path = File.GetPhysicalPath(path); } gif.Bitmap = new Bitmap(path); gif.BitmapSource = GetBitmapSource(gif.Bitmap, gif.BitmapSource); gif.StartAnimate(); }
private static void OnAnimatioinEnableChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { AnimatedGIF gif = sender as AnimatedGIF; if (gif == null) { return; } if (!gif.IsLoaded) { return; } if (gif.AnimatioinEnable) { gif.StartAnimate(); } else { gif.StopAnimate(); } }