public SubTextureViewModel(SubTexture subTexture)
 {
     this.Name = subTexture.Name;
     this.X = subTexture.X;
     this.Y = subTexture.Y;
     this.Width = subTexture.Width;
     this.Height = subTexture.Height;
 }
        public AnimationFrameViewModel(SubTexture subTexture, BitmapImage image)
        {
            this.Name = subTexture.Name;
            this.X = subTexture.X;
            this.Y = subTexture.Y;
            this.Width = subTexture.Width;
            this.Height = subTexture.Height;

            Int32 frameIndex = -1;
            //There should be 4 padding zeros
            Int32.TryParse(Name.Substring(Name.Length - 4, 4), out frameIndex);
            this.Index = frameIndex;

            this.frameImage = new CroppedBitmap(image, new System.Windows.Int32Rect(x, y, width, height));
        }