private void ShowImage(Image img)
{
int num = 0;
for (int i = base.Container.Children.Count - 1; i >= 0; i--)
{
FrameworkElement element = base.Container.Children[num] as FrameworkElement;
if (img == element)
{
num++;
}
else if (element.Parent != null)
{
(element.Parent as Panel).Children.Remove(element);
}
}
img.Opacity = 1.0;
if ((bool)img.DataContext)
{
Storyboard storyboard = new Storyboard();
DoubleAnimation animation = new DoubleAnimation
{
From = new double?(img.Opacity),
To = 1.0,
Duration = TimeSpan.FromSeconds(0.5)
};
animation.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Opacity", new object[0]));
storyboard.Children.Add(animation);
Storyboard.SetTarget(animation, img);
storyboard.Begin();
}
else
{
img.Opacity = 1.0;
}
}