public ProgramListItem(ProgramProperties program)
 {
     _programProperty = new WProperty(typeof (ProgramProperties), program);
       SetLabel(Consts.KEY_NAME, program.Title);
       SetLabel("Title", program.Title);
       SetLabel("StartTime", FormatHelper.FormatProgramTime(program.StartTime));
       SetLabel("EndTime", FormatHelper.FormatProgramTime(program.EndTime));
 }
        private ProgramListItem NoProgramPlaceholder()
        {
            ILocalization loc = ServiceRegistration.Get<ILocalization>();
              DateTime today = FormatHelper.GetDay(DateTime.Now);

              ProgramProperties programProperties = new ProgramProperties(GuideStartTime, GuideEndTime)
                                              {
                                                Title = loc.ToString("[SlimTvClient.NoProgram]"),
                                                StartTime = today,
                                                EndTime = today.AddDays(1)
                                              };
              return new ProgramListItem(programProperties);
        }
        protected ItemsList GetProgramsList(IChannel channel, DateTime referenceStart, DateTime referenceEnd)
        {
            ItemsList channelPrograms = new ItemsList();
              if (_tvHandler.ProgramInfo.GetPrograms(channel, referenceStart, referenceEnd, out _programs))
              {
            foreach (IProgram program in _programs)
            {
              // Use local variable, otherwise delegate argument is not fixed
              ProgramProperties programProperties = new ProgramProperties(GuideStartTime, GuideEndTime);
              IProgram currentProgram = program;
              programProperties.SetProgram(currentProgram);

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

              channelPrograms.Add(item);
            }
              }
              else
            channelPrograms.Add(NoProgramPlaceholder());
              return channelPrograms;
        }
Exemplo n.º 4
0
 private static void CreateProgramListItem(IProgram program, ItemsList channelPrograms)
 {
     ProgramListItem item;
       if (program == null)
     item = GetNoProgramPlaceholder();
       else
       {
     ProgramProperties programProperties = new ProgramProperties();
     programProperties.SetProgram(program);
     item = new ProgramListItem(programProperties);
       }
       item.AdditionalProperties["PROGRAM"] = program;
       channelPrograms.Add(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;
        }