protected override void UpdateChannels()
        {
            base.UpdateChannels();
            if (_webChannelGroupIndex < _channelGroups.Count)
            {
                IChannelGroup currentGroup = _channelGroups[_webChannelGroupIndex];
                CurrentGroupName = currentGroup.Name;
            }
            _channelList.Clear();
            if (_channels == null)
            {
                return;
            }

            foreach (IChannel channel in _channels)
            {
                // Use local variable, otherwise delegate argument is not fixed
                IChannel currentChannel = channel;

                ChannelProgramListItem item = new ChannelProgramListItem(currentChannel, GetNowAndNextProgramsList(currentChannel))
                {
                    Command = new MethodDelegateCommand(() => Tune(currentChannel))
                };
                item.AdditionalProperties["CHANNEL"] = channel;
                _channelList.Add(item);
            }
            CurrentGroupChannels.FireChange();
        }
        protected override void UpdateChannels()
        {
            base.UpdateChannels();
            if (_webChannelGroupIndex < _channelGroups.Count)
            {
                IChannelGroup currentGroup = _channelGroups[_webChannelGroupIndex];
                CurrentGroupName = currentGroup.Name;
            }
            _channelList.Clear();
            if (_channels == null)
            {
                return;
            }

            foreach (IChannel channel in _channels)
            {
                // Use local variable, otherwise delegate argument is not fixed
                IChannel currentChannel = channel;

                ChannelProgramListItem item = new ChannelProgramListItem(currentChannel, null)
                {
                    Programs = new ItemsList {
                        GetNoProgramPlaceholder(), GetNoProgramPlaceholder()
                    },
                    Command = new MethodDelegateCommand(() => Tune(currentChannel))
                };
                item.AdditionalProperties["CHANNEL"] = channel;
                // Load programs asynchronously, this increases performance of list building
                GetNowAndNextProgramsList(item, currentChannel);
                _channelList.Add(item);
            }
            CurrentGroupChannels.FireChange();
        }
Example #3
0
        private void UpdateChannelGroupSelection(IChannel channel)
        {
            if (channel == null)
            {
                return;
            }

            foreach (ChannelProgramListItem currentGroupChannel in CurrentGroupChannels)
            {
                currentGroupChannel.Selected = IsSameChannel(currentGroupChannel.Channel, channel);
            }

            CurrentGroupChannels.FireChange();
        }
Example #4
0
        private void UpdateChannelGroupSelection(IChannel channel)
        {
            if (channel == null)
            {
                return;
            }

            lock (CurrentGroupChannels.SyncRoot)
                foreach (ChannelProgramListItem currentGroupChannel in CurrentGroupChannels)
                {
                    currentGroupChannel.Selected = ChannelContext.IsSameChannel(currentGroupChannel.Channel, channel);
                }

            CurrentGroupChannels.FireChange();

            SetCurrentChannelGroup();
            SetCurrentChannel();
        }
Example #5
0
        protected override void UpdateChannels()
        {
            base.UpdateChannels();
            if (CurrentChannelGroup != null)
            {
                CurrentGroupName = CurrentChannelGroup.Name;
            }
            _channelList.Clear();

            bool isOneSelected = false;

            foreach (IChannel channel in ChannelContext.Channels)
            {
                // Use local variable, otherwise delegate argument is not fixed
                IChannel currentChannel = channel;

                bool isCurrentSelected = IsSameChannel(currentChannel, _lastTunedChannel);
                isOneSelected |= isCurrentSelected;
                ChannelProgramListItem item = new ChannelProgramListItem(currentChannel, null)
                {
                    Programs = new ItemsList {
                        GetNoProgramPlaceholder(), GetNoProgramPlaceholder()
                    },
                    Command  = new MethodDelegateCommand(() => Tune(currentChannel)),
                    Selected = isCurrentSelected
                };
                item.AdditionalProperties["CHANNEL"] = channel;
                _channelList.Add(item);
            }
            // Adjust channel list position
            ChannelContext.Channels.MoveTo(c => IsSameChannel(c, _lastTunedChannel));

            // If the current watched channel is not part of the channel group, set the "selected" property to first list item to make sure focus will be set to the list view
            if (!isOneSelected && _channelList.Count > 0)
            {
                _channelList.First().Selected = true;
            }

            // Load programs asynchronously, this increases performance of list building
            GetNowAndNextProgramsList_Async();
            CurrentGroupChannels.FireChange();
        }