Business.WmpPlayerBusiness.timerGetPosition_Tick C# (CSharp) Method

timerGetPosition_Tick() private method

Occurs every second. Detects end position, start position or restore position.
private timerGetPosition_Tick ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void timerGetPosition_Tick(object sender, EventArgs e) {
            if (timerGetPositionEnabled) {
                if ((EndPos.HasValue && position > EndPos && !IgnorePos) || position > CurrentVideo.Length - 1) {
                    // End position reached.
                    if (PlayNext != null) {
                        //timerGetPositionEnabled = false;
                        player.Dispatcher.Invoke(() => PlayNext(this, new EventArgs()));
                    }
                } else if (restorePosition == 0 && StartPos.HasValue && StartPos > 10 && position < StartPos && !IgnorePos) {
                    // Skip to start position.
                    restorePosition = StartPos.Value;
                }

                if (restorePosition > 0) {
                    // Restore to specified position (usually after a crash).
                    if (restorePosition > 10) {
                        timerGetPositionEnabled = false;
                        position = restorePosition;
                        player.Position = restorePosition;
                        timerGetPositionEnabled = true;
                    }
                    restorePosition = 0;
                } else
                    TrackPosition();
            }
        }