public void GoToChannelIndex(int number)
 {
     if (number >= 0 && number < ChannelList.Count)
     {
         SlimTvClientMessaging.SendSlimTvClientMessage(SlimTvClientMessaging.MessageType.GoToChannelIndex, "Channel", number);
     }
 }
        protected virtual async Task <RecordingStatus?> CreateSchedule(IProgram program, ScheduleRecordingType recordingType = ScheduleRecordingType.Once)
        {
            IScheduleControlAsync scheduleControl = _tvHandler.ScheduleControl;
            RecordingStatus?      newStatus       = null;

            if (scheduleControl != null)
            {
                RecordingStatus?recordingStatus = await GetRecordingStatusAsync(program);

                if (recordingStatus.HasValue && (recordingStatus.Value.HasFlag(RecordingStatus.Scheduled) || recordingStatus.Value.HasFlag(RecordingStatus.SeriesScheduled)))
                {
                    // Delete any existing schedule
                    if (await scheduleControl.RemoveScheduleForProgramAsync(program, recordingStatus.Value.HasFlag(RecordingStatus.SeriesScheduled) ? ScheduleRecordingType.EveryTimeOnEveryChannel : ScheduleRecordingType.Once))
                    {
                        newStatus = RecordingStatus.None;
                    }
                }
                // Now create new schedule
                var result = await scheduleControl.CreateScheduleAsync(program, recordingType);

                if (result.Success)
                {
                    newStatus = recordingType == ScheduleRecordingType.Once ? RecordingStatus.Scheduled : RecordingStatus.SeriesScheduled;
                    UpdateRecordingStatus(program, (RecordingStatus)newStatus, recordingType);
                    SlimTvClientMessaging.SendSlimTvProgramChangedMessage(program);
                }
            }
            return(newStatus);
        }
 private void NotifyAllPrograms()
 {
     // Send message to all listeners that programs might have been changed
     foreach (IProgram program in _programs)
     {
         SlimTvClientMessaging.SendSlimTvProgramChangedMessage(program);
     }
 }
Exemple #4
0
 protected override void OnCurrentGroupChanged(int oldindex, int newindex)
 {
     base.OnCurrentGroupChanged(oldindex, newindex);
     UpdateChannels();
     UpdatePrograms();
     // Notify listeners about group change
     SlimTvClientMessaging.SendSlimTvClientMessage(SlimTvClientMessaging.MessageType.GroupChanged);
 }
Exemple #5
0
        protected void UpdatePrograms()
        {
            UpdateProgramsForGroup();
            foreach (ChannelProgramListItem channel in _channelList)
            {
                UpdateChannelPrograms(channel);
            }

            _channelList.FireChange();
            SlimTvClientMessaging.SendSlimTvClientMessage(SlimTvClientMessaging.MessageType.ProgramsChanged);
            UpdateProgramsState();
        }
        protected virtual bool UpdateRecordingStatus(IProgram program, RecordingStatus newStatus)
        {
            IProgramRecordingStatus status = program as IProgramRecordingStatus;

            if (status == null)
            {
                return(false);
            }

            status.RecordingStatus = newStatus;
            SlimTvClientMessaging.SendSlimTvProgramChangedMessage(program);
            return(true);
        }
        /// <summary>
        /// Reload all channels if channel group is changed.
        /// </summary>
        /// <param name="oldindex">Index of previous selected entry</param>
        /// <param name="newindex">Index of current selected entry</param>
        private void ReloadChannels(int oldindex, int newindex)
        {
            IList <IChannel> channels;
            var tvHandler = ServiceRegistration.Get <ITvHandler>(false);

            if (tvHandler != null && tvHandler.ChannelAndGroupInfo.GetChannels(ChannelGroups.Current, out channels))
            {
                Channels.Clear();
                Channels.AddRange(channels);
                Channels.FireListChanged();
                // Check if the current channel is part of new group and select it
                int selectedChannelId = tvHandler.ChannelAndGroupInfo.SelectedChannelId;
                if (tvHandler.ChannelAndGroupInfo != null && selectedChannelId != 0)
                {
                    Channels.MoveTo(channel => channel.ChannelId == selectedChannelId);
                }
            }
            // Notify listeners about group change
            SlimTvClientMessaging.SendSlimTvClientMessage(SlimTvClientMessaging.MessageType.GroupChanged);
        }
        protected async Task UpdateProgramsAfterScroll(TimeSpan difference)
        {
            await updatePrograms();

            SlimTvClientMessaging.SendSlimTvClientMessage(SlimTvClientMessaging.MessageType.ProgramsChanged, "MoveCursor", difference);
        }
        protected async Task UpdatePrograms()
        {
            await updatePrograms();

            SlimTvClientMessaging.SendSlimTvClientMessage(SlimTvClientMessaging.MessageType.ProgramsChanged);
        }
Exemple #10
0
 /// <summary>
 /// Sets the current channel group and updates the channel list.
 /// </summary>
 public void SetGroup()
 {
     FillChannelGroupList();
     UpdateChannels();
     SlimTvClientMessaging.SendSlimTvClientMessage(SlimTvClientMessaging.MessageType.GroupChanged);
 }