/// <summary>
 /// Pause at current imgIndex frame
 /// </summary>
 private void Pause_ButtonClick(object sender, RoutedEventArgs e)
 {
     //Go to previous frame and then iterate back to the frame you were at
     imgIndex -= 1;
     imgIndex  = SpritePreviewer.PlayNextFrame(imgIndex, imageYIndexTextBox, imageXIndexTextBox, frameCount,
                                               SpritesPerRowTextBox, ImageFileNameTextBox, SpritesPerColumnTextBox, Test_Img);
     _CurrentPlaying = false;
 }
 /// <summary>
 /// reset the image frame back to the beginning
 /// </summary>
 private void Stop_ButtonClick(object sender, RoutedEventArgs e)
 {
     //Set imgIndex to -1 so the next frame is 0 (the start)
     if (InputHandling.isNumeric(imageXIndexTextBox, imageYIndexTextBox, SpritesPerColumnTextBox, SpritesPerRowTextBox))
     {
         imgIndex = -1;
         imgIndex = SpritePreviewer.PlayNextFrame(imgIndex, imageYIndexTextBox, imageXIndexTextBox, frameCount,
                                                  SpritesPerRowTextBox, ImageFileNameTextBox, SpritesPerColumnTextBox, Test_Img);
         _CurrentPlaying = false;
     }
 }
 void _BackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     while (_CurrentPlaying)
     {
         this.Dispatcher.BeginInvoke((Action) delegate()
         {
             imgIndex = SpritePreviewer.PlayNextFrame(imgIndex, imageYIndexTextBox, imageXIndexTextBox, frameCount,
                                                      SpritesPerRowTextBox, ImageFileNameTextBox, SpritesPerColumnTextBox, Test_Img);
         });
         System.Threading.Thread.Sleep(duration);
     }
 }