示例#1
0
        private void OnAvailableBitratesChanged()
        {
            var minBitrate = AvailableBitrates.Any()
                                 ? AvailableBitrates.Min()
                                 : 0;

            var maxBitrate = AvailableBitrates.Any()
                                 ? AvailableBitrates.Max()
                                 : 0;

            if (_nowDownloadingSlider != null)
            {
                _nowDownloadingSlider.Minimum = 0;
                _nowDownloadingSlider.Maximum = maxBitrate / 1000.0;
                _nowDownloadingSlider.Value   = 0;
            }

            if (_limitMaxBitrateSlider != null)
            {
                // Update the bitrate limiter slider
                _limitMaxBitrateSlider.Minimum = Math.Ceiling(minBitrate / 1000.0); // Round up otherwise we exclude bottom bitrate from eligibility
                _limitMaxBitrateSlider.Maximum = Math.Ceiling(maxBitrate / 1000.0); // Round up otherwise we exclude top bitrate from eligibility
                _limitMaxBitrateSlider.Value   = _limitMaxBitrateSlider.Maximum;
            }
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _bitrateGraphCanvas = GetTemplateChild(BitrateGraphCanvasName) as Canvas;

            isLoaded = true;

            if (AvailableBitrates.Any())
            {
                OnAvailableBitratesChanged();
            }
        }