private void UpdatePlayBar() { if (this.SmoothPlayer.NaturalDuration.TimeSpan != TimeSpan.Zero) { this.slider.Maximum = this.slider.ActualWidth; CustumSlider totalMilliseconds = this.slider; double num = this.SmoothPlayer.Position.TotalMilliseconds; TimeSpan timeSpan = this.SmoothPlayer.NaturalDuration.TimeSpan; totalMilliseconds.Value = num / timeSpan.TotalMilliseconds * this.slider.ActualWidth; } }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/SilverlightMediaPlayer;component/Player.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.SmoothPlayer = ((Microsoft.Web.Media.SmoothStreaming.SmoothStreamingMediaElement)(this.FindName("SmoothPlayer"))); this.bitRateGraph = ((SilverlightMediaPlayer.BitrateGraphControl)(this.FindName("bitRateGraph"))); this.framerateControl = ((SilverlightMediaPlayer.FramerateGraphControl)(this.FindName("framerateControl"))); this.maxFramerateControl = ((SilverlightMediaPlayer.MaxBitrateLimiterControl)(this.FindName("maxFramerateControl"))); this.eventLogViewer = ((SilverlightMediaPlayer.EventsLog)(this.FindName("eventLogViewer"))); this.ControllerContainer = ((System.Windows.Controls.Grid)(this.FindName("ControllerContainer"))); this.playercontrols = ((System.Windows.Controls.Grid)(this.FindName("playercontrols"))); this.ReplayElement = ((System.Windows.Controls.Button)(this.FindName("ReplayElement"))); this.RewindElement = ((System.Windows.Controls.Button)(this.FindName("RewindElement"))); this.playButton = ((System.Windows.Controls.Button)(this.FindName("playButton"))); this.pauseButton = ((System.Windows.Controls.Button)(this.FindName("pauseButton"))); this.FastForwardElement = ((System.Windows.Controls.Button)(this.FindName("FastForwardElement"))); this.SlowMotionElement = ((System.Windows.Controls.Primitives.ToggleButton)(this.FindName("SlowMotionElement"))); this.divider1 = ((System.Windows.Controls.Grid)(this.FindName("divider1"))); this.timelinecontrols = ((System.Windows.Controls.Grid)(this.FindName("timelinecontrols"))); this.slider = ((SilverlightMediaPlayer.CustumSlider)(this.FindName("slider"))); this.TimeContainer = ((System.Windows.Controls.Border)(this.FindName("TimeContainer"))); this.CurrentPositionElement = ((System.Windows.Controls.TextBlock)(this.FindName("CurrentPositionElement"))); this.TimeSeparatorElement = ((System.Windows.Controls.TextBlock)(this.FindName("TimeSeparatorElement"))); this.CurrentDurationElement = ((System.Windows.Controls.TextBlock)(this.FindName("CurrentDurationElement"))); this.volumeslider = ((System.Windows.Controls.Slider)(this.FindName("volumeslider"))); this.divider2 = ((System.Windows.Controls.Grid)(this.FindName("divider2"))); this.functioncontrols = ((System.Windows.Controls.Grid)(this.FindName("functioncontrols"))); this.GraphToggleElement = ((System.Windows.Controls.Primitives.ToggleButton)(this.FindName("GraphToggleElement"))); this.LogToggleElement = ((System.Windows.Controls.Primitives.ToggleButton)(this.FindName("LogToggleElement"))); this.FullScreenToggleElement = ((System.Windows.Controls.Primitives.ToggleButton)(this.FindName("FullScreenToggleElement"))); this.divider3 = ((System.Windows.Controls.Grid)(this.FindName("divider3"))); }