/// <summary> /// When Play button is pressed, this event executes /// </summary> private void Play_Click(object sender, RoutedEventArgs e) { if (InputHandling.isNumeric(imageXIndexTextBox, imageYIndexTextBox, SpritesPerColumnTextBox, SpritesPerRowTextBox)) { if ((SpritesPerRowTextBox.Text != "") && (SpritesPerColumnTextBox.Text != "") && (imageYIndexTextBox.Text != "") && (imageXIndexTextBox.Text != "") && (frameCount.Text != "") && (ImageFileNameTextBox.Text != "") && _IsPlaying == false) { _IsPlaying = true; _CurrentPlaying = true; _BackgroundWorker.RunWorkerAsync(); int frameSpeed = (int)(Convert.ToSingle(txtAnimationDuration.Text) * 1000); if (frameSpeed < minSpeed) { txtAnimationDuration.Text = "0.05"; } duration = string.IsNullOrEmpty(txtAnimationDuration.Text) ? 125 : Math.Max(frameSpeed, minSpeed); } else if (_IsPlaying && _CurrentPlaying) { //nothing should happen because its playing so no errors } else { MessageBoxes.Alert_PopUP("Missing field entries"); } } }
/// <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; } }