private void ProgressSlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) { // Use slider value to set Progress (current frame / total frames). var progress = e.NewValue; Progress_Player.SetProgress(progress); // Reset toggle switch if Progress crosses segment threshold. LightToggle.IsOn = progress > ClickedSegmentFromProgress; }
private void LightToggle_Toggled(object sender, RoutedEventArgs e) { // Toggle On => frame at progress 1.0 // Toggle Off => frame at progress 0.0 // Progress [0.0, 0.69] => Toggle On // Progress (0.69, 1.0] => Toggle Off var progress = ProgressSlider.Value; var value = LightToggle.IsOn ? (progress > ClickedSegmentFromProgress ? progress : 1) : (progress <= ClickedSegmentFromProgress ? progress : 0); if (value == 1.0 || value == 0.0) { Progress_Player.SetProgress(value); ProgressSlider.Value = value; } }