using System;
using System.Windows.Controls;
using C1.Silverlight.Imaging;
using System.Windows;
using System.Reflection;

namespace C1Imaging_Demo
{
    public partial class DemoGifImage : UserControl
    {
        C1GifImage _gifImage;
        bool _play = true;
        
        public DemoGifImage()
        {
            InitializeComponent();

            _gifImage = new C1GifImage(new Uri("/" + new AssemblyName(Assembly.GetExecutingAssembly().FullName).Name + ";component/Resources/Babycha.gif", UriKind.Relative));
            image.Source = _gifImage;
        }

        public bool Play
        {
            get { return _play; }
            set 
            {
                if (_play != value)
                {
                    _play = value;
                    if (_play)
                    {
                        _gifImage.Play();
                    }
                    else
                    {
                        _gifImage.Stop();
                    }
                }
            }
        }
    }
}
