/// <summary> /// Uses durations from the specified image to set up the control for indexing. /// </summary> /// <typeparam name="T">The type of the frame images.</typeparam> /// <param name="image">The image whose durations should be used to specify frame and time indexes.</param> public void UseTimingsFrom <T>(GifImage <T> image) { PlaybackTimer.Stop(); if (image == null) { durations = null; sectionValues = null; FrameSelector.Maximum = 0; TimeSelector.Maximum = 0; FrameLabel.Text = ""; Enabled = false; } else { durations = new int[image.Frames.Length]; sectionValues = new int[image.Frames.Length + 1]; sectionValues[0] = 0; int accumulatedDuration = 0; for (int i = 0; i < image.Frames.Length; i++) { int duration = image.Frames[i].Duration; durations[i] = duration; accumulatedDuration += duration; sectionValues[i + 1] = accumulatedDuration; } FrameSelector.Maximum = image.Frames.Length - 1; TimeSelector.Maximum = image.Duration; UpdateLabel(); Enabled = true; } TimeSelectorSections.Invalidate(); }
/// <summary> /// Stops seeking through the indexes. /// </summary> public void Pause() { PlaybackTimer.Stop(); }
/// <summary> /// Starts seeking through the indexes automatically. /// </summary> public void Play() { PlaybackTimer.Start(); }
public void StopPlaying() { PlaybackTimer.Stop(); CurrentTrack = null; LastSwitchedSongEvent = null; }
private void StartTimer(double interval) { PlaybackTimer.Stop(); PlaybackTimer.Interval = interval; PlaybackTimer.Start(); }