SuperMap.WindowsPhone.Mapping.TiledLayer.ShowImage C# (CSharp) Method

ShowImage() private method

private ShowImage ( Image img, bool enableFading ) : void
img Image
enableFading bool
return void
        private void ShowImage(Image img, bool enableFading)
        {
            if (enableFading)
            {
                DoubleAnimation animation = new DoubleAnimation
                {
                    From = new double?(img.Opacity),
                    To = 1.0,
                    Duration = TimeSpan.FromSeconds(0.5)
                };
                animation.SetValue(Storyboard.TargetPropertyProperty, "Opacity");

                Storyboard storyboard = new Storyboard();
                storyboard.Children.Add(animation);
                Storyboard.SetTarget(animation, img);
                storyboard.Completed += (s, e) =>
                {
                    base.Dispatcher.BeginInvoke(() => { base.OnProgress(this.GetProgress()); });
                };
                storyboard.Begin();
            }
            else
            {
                img.Opacity = 1.0;
            }

            base.OnProgress(this.GetProgress()); //到处都有你的身影
        }