public ProgramListItem(ProgramProperties program)
 {
   _programProperty = new WProperty(typeof(ProgramProperties), program);
   _isRunningProperty = new WProperty(typeof(bool), false);
   SetLabel(Consts.KEY_NAME, program.Title);
   SetLabel("Title", program.Title);
   SetLabel("StartTime", FormatHelper.FormatProgramTime(program.StartTime));
   SetLabel("EndTime", FormatHelper.FormatProgramTime(program.EndTime));
   Update();
 }
Beispiel #2
0
 public ProgramListItem(ProgramProperties program)
 {
     _programProperty   = new WProperty(typeof(ProgramProperties), program);
     _isRunningProperty = new WProperty(typeof(bool), false);
     _progressProperty  = new WProperty(typeof(double), 0d);
     SetLabel(Consts.KEY_NAME, program.Title);
     SetLabel("Title", program.Title);
     SetLabel("StartTime", program.StartTime.FormatProgramTime());
     SetLabel("EndTime", program.EndTime.FormatProgramTime());
     Update();
 }
 private static ProgramListItem GetNoProgramPlaceholder(IProgram previousProgram = null)
 {
   IProgram placeHolder = GetNoProgram(previousProgram);
   ProgramProperties programProperties = new ProgramProperties
   {
     Title = placeHolder.Title,
     StartTime = placeHolder.StartTime,
     EndTime = placeHolder.EndTime
   };
   return new ProgramListItem(programProperties);
 }
 protected void UpdateForChannel(IChannel channel, ProgramProperties current, ProgramProperties next, AbstractProperty channelNameProperty, AbstractProperty progressProperty)
 {
   channelNameProperty.SetValue(channel.Name);
   IProgram currentProgram;
   IProgram nextProgram;
   if (_tvHandler.ProgramInfo.GetNowNextProgram(channel, out currentProgram, out nextProgram))
   {
     current.SetProgram(currentProgram);
     next.SetProgram(nextProgram);
     double progress = (DateTime.Now - currentProgram.StartTime).TotalSeconds / (currentProgram.EndTime - currentProgram.StartTime).TotalSeconds * 100;
     progressProperty.SetValue(progress);
   }
   else
   {
     current.SetProgram(null);
     next.SetProgram(null);
     progressProperty.SetValue(100d);
   }
 }
    private PlaceholderListItem NoProgramPlaceholder(IChannel channel, DateTime? startTime, DateTime? endTime)
    {
      ILocalization loc = ServiceRegistration.Get<ILocalization>();
      DateTime today = GuideStartTime.GetDay();
      ProgramProperties programProperties = new ProgramProperties();
      Program placeholderProgram = new Program
                              {
                                ProgramId = -1,
                                ChannelId = channel.ChannelId,
                                Title = loc.ToString("[SlimTvClient.NoProgram]"),
                                StartTime = startTime ?? today,
                                EndTime = endTime ?? today.AddDays(1)
                              };
      programProperties.SetProgram(placeholderProgram);

      var item = new PlaceholderListItem(programProperties)
      {
        Command = new MethodDelegateCommand(() => ShowProgramActions(placeholderProgram))
      };
      item.AdditionalProperties["PROGRAM"] = placeholderProgram;

      return item;
    }
    private ProgramListItem BuildProgramListItem(IProgram program)
    {
      ProgramProperties programProperties = new ProgramProperties();
      IProgram currentProgram = program;
      programProperties.SetProgram(currentProgram);

      ProgramListItem item = new ProgramListItem(programProperties)
        {
          Command = new MethodDelegateCommand(() => ShowProgramActions(currentProgram))
        };
      item.AdditionalProperties["PROGRAM"] = currentProgram;
      return item;
    }
    private PlaceholderListItem NoProgramPlaceholder(IChannel channel, DateTime? startTime, DateTime? endTime)
    {
      ILocalization loc = ServiceRegistration.Get<ILocalization>();
      DateTime today = FormatHelper.GetDay(DateTime.Now);
      ProgramProperties programProperties = new ProgramProperties(GuideStartTime, GuideEndTime);
      Program placeholderProgram = new Program
                              {
                                ChannelId = channel.ChannelId,
                                Title = loc.ToString("[SlimTvClient.NoProgram]"),
                                StartTime = startTime.HasValue ? startTime.Value : today,
                                EndTime = endTime.HasValue? endTime.Value : today.AddDays(1)
                              };
      programProperties.SetProgram(placeholderProgram);
      
      var item = new PlaceholderListItem(programProperties);
      item.AdditionalProperties["PROGRAM"] = placeholderProgram;

      return item;
    }
    protected override void UpdatePrograms()
    {
      _programsList.Clear();
      if (_channel != null)
      {
        if (_tvHandler.ProgramInfo.GetPrograms(_channel, DateTime.Now.AddHours(-2), DateTime.Now.AddHours(24), out _programs))
        {
          foreach (IProgram program in _programs)
          {
            // Use local variable, otherwise delegate argument is not fixed
            ProgramProperties programProperties = new ProgramProperties();
            IProgram currentProgram = program;
            programProperties.SetProgram(currentProgram);

            ProgramListItem item = new ProgramListItem(programProperties)
                              {
                                Command = new MethodDelegateCommand(() => ShowProgramActions(currentProgram))
                              };
            item.AdditionalProperties["PROGRAM"] = currentProgram;

            _programsList.Add(item);
          }
        }
        ProgramsList.FireChange();
      }
      else
        _programs = null;
    }
 public PlaceholderListItem(ProgramProperties program)
   : base(program)
 { }
    private void FillProgramsList()
    {
      _programsList.Clear();

      foreach (IProgram program in _programs)
      {
        // Use local variable, otherwise delegate argument is not fixed
        ProgramProperties programProperties = new ProgramProperties();
        IProgram currentProgram = program;
        programProperties.SetProgram(currentProgram);

        if (ProgramComparer.Instance.Equals(currentProgram, program))
        {
        }

        ProgramListItem item = new ProgramListItem(programProperties)
        {
          Command = new MethodDelegateCommand(() =>
          {
            var isSingle = programProperties.IsScheduled;
            var isSeries = programProperties.IsSeriesScheduled;
            if (isSingle || isSeries)
              CancelSchedule(currentProgram);
            else
              RecordSeries(currentProgram);
          })
        };
        item.AdditionalProperties["PROGRAM"] = currentProgram;
        item.Selected = _lastProgramId == program.ProgramId; // Restore focus

        _programsList.Add(item);
      }

      _programsList.FireChange();
    }
Beispiel #11
0
 public ProgramListItem(ProgramProperties program)
 {
   _programProperty = new WProperty(typeof(ProgramProperties), program);
   _isRunningProperty = new WProperty(typeof(bool), false);
   _progressProperty = new WProperty(typeof(double), 0d);
   SetLabel(Consts.KEY_NAME, program.Title);
   SetLabel("Title", program.Title);
   SetLabel("StartTime", program.StartTime.FormatProgramTime());
   SetLabel("EndTime", program.EndTime.FormatProgramTime());
   SetLabel("Series", BuildSeriesText(program));
   Update();
 }
Beispiel #12
0
 private string BuildSeriesText(ProgramProperties program)
 {
   if (!ServiceRegistration.Get<ISettingsManager>().Load<SlimTvClientSettings>().ShowSeriesInfo)
     return null;
   var text = ProgramProperties.BuildSeriesText(program);
   return string.IsNullOrEmpty(text) ? null : string.Format("({0})", text);
 }
    private ListItem CreateProgramItem(IProgram program, ISchedule schedule)
    {
      ProgramProperties programProperties = new ProgramProperties();
      IProgram currentProgram = program;
      programProperties.SetProgram(currentProgram);

      ListItem item = new ProgramListItem(programProperties)
      {
        Command = new MethodDelegateCommand(() => ShowActions(schedule, program))
      };
      IChannel channel;
      if (_tvHandler.ChannelAndGroupInfo.GetChannel(currentProgram.ChannelId, out channel))
        item.SetLabel("ChannelName", channel.Name);
      item.SetLabel("ScheduleType", string.Format("[SlimTvClient.ScheduleRecordingType_{0}]", schedule.RecordingType));
      item.AdditionalProperties["PROGRAM"] = currentProgram;
      item.AdditionalProperties["SCHEDULE"] = schedule;
      return item;
    }
 public PlaceholderListItem(ProgramProperties program)
     : base(program)
 {
 }
    private void FillProgramsList()
    {
      _programsList.Clear();

      bool isSingle = false;
      bool isSeries = false;
      foreach (IProgram program in _programs)
      {
        // Use local variable, otherwise delegate argument is not fixed
        ProgramProperties programProperties = new ProgramProperties();
        IProgram currentProgram = program;
        programProperties.SetProgram(currentProgram);

        if (ProgramComparer.Instance.Equals(_selectedProgram, program))
        {
          isSingle = programProperties.IsScheduled;
          isSeries = programProperties.IsSeriesScheduled;
        }

        ProgramListItem item = new ProgramListItem(programProperties)
        {
          Command = new MethodDelegateCommand(() => CreateOrDeleteSchedule(currentProgram))
        };
        item.AdditionalProperties["PROGRAM"] = currentProgram;
        item.Selected = _lastProgramId == program.ProgramId; // Restore focus

        _programsList.Add(item);
      }

      // "Record" buttons are related to properties, for schedules we need to keep them to "Cancel record" state.
      if (_isScheduleMode)
        isSingle = isSeries = _selectedSchedule != null;

      IsSingleRecordingScheduled = isSingle;
      IsSeriesRecordingScheduled = isSeries;

      _programsList.FireChange();
    }
    public static string BuildSeriesText(ProgramProperties program)
    {
      if (string.IsNullOrEmpty(program.SeasonNumber) && string.IsNullOrEmpty(program.EpisodeNumber))
        return null;

      return string.Format("{0}{1}{2} {3}", program.SeasonNumber, string.IsNullOrEmpty(program.SeasonNumber) ? "" : ".", program.EpisodeNumber, program.EpisodeTitle).TrimEnd();
    }