示例#1
0
        public ScheduleViewModel(WebProgramDetailed program)
            : this(program.StartTime, program.EndTime, program.Title, program.IdChannel)
        {
            ProgramId = program.Id;

            ChannelName = MPEServices.TAS.GetChannelDetailedById(program.IdChannel).DisplayName;
        }
        public ScheduleViewModel(WebProgramDetailed program)
            : this(program.StartTime, program.EndTime, program.Title, program.ChannelId)
        {
            ProgramId = program.Id;

            ChannelName = Connections.Current.TAS.GetChannelDetailedById(program.ChannelId).Title;
        }
        public ProgramDetailsViewModel(WebProgramDetailed program)
        {
            Program = program;

            var channel = Connections.Current.TAS.GetChannelDetailedById(program.ChannelId);
            ChannelName = channel.Title;
            ChannelId = channel.Id;
        }
 private string GetCssClass(WebProgramDetailed program)
 {
     if (program.IsScheduled)
         return "TVGuideCellProgramOnScheduled";
     else if (program.StartTime <= DateTime.Now && program.EndTime >= DateTime.Now)
         return "TVGuideCellProgramOnAir";
     else
         return "TVGuideCellProgram";
 }
        public SingleTVProgramModel(WebProgramDetailed program, DateTime overallStartTime, DateTime overallEndTime)
        {
            Title = program.Title;
            StartTime = program.StartTime;
            EndTime = program.EndTime;
            IdProgram = program.Id;

            PercentageWidth = GetPercentageWidth(program, overallStartTime, overallEndTime);
            CssClass = GetCssClass(program);
        }
示例#6
0
 public static RecordingStatus GetRecordingStatus(WebProgramDetailed programDetailed)
 {
   RecordingStatus recordingStatus = RecordingStatus.None;
   if (programDetailed.IsRecording || programDetailed.IsRecordingOnce || programDetailed.IsRecordingSeries)
     recordingStatus |= RecordingStatus.Recording;
   if (programDetailed.IsScheduled || programDetailed.IsRecordingOncePending)
     recordingStatus |= RecordingStatus.Scheduled;
   if (programDetailed.IsRecordingSeriesPending)
     recordingStatus |= RecordingStatus.SeriesScheduled;
   return recordingStatus;
 }
示例#7
0
 public Program(WebProgramDetailed webProgram, int serverIndex)
 {
   ServerIndex = serverIndex;
   Description = webProgram.Description;
   StartTime = webProgram.StartTime;
   EndTime = webProgram.EndTime;
   Genre = webProgram.Genre;
   Title = webProgram.Title;
   ChannelId = webProgram.ChannelId;
   ProgramId = webProgram.Id;
   RecordingStatus = GetRecordingStatus(webProgram);
 }
示例#8
0
        public ProgramDetailsViewModel(WebProgramDetailed program)
        {
            Id = program.Id;
            Title = String.IsNullOrEmpty(program.Title) ? UIStrings.Unknown : program.Title; // creating links with empty text doesn't work
            Description = program.Description;
            StartTime = program.StartTime;
            EndTime = program.EndTime;
            IsScheduled = program.IsScheduled;

            var channel = MPEServices.TAS.GetChannelDetailedById(program.IdChannel);
            ChannelName = channel.DisplayName;
        }
        public ProgramDetailsViewModel(WebProgramDetailed program)
        {
            Id = program.Id;
            Title = String.IsNullOrEmpty(program.Title) ? UIStrings.Unknown : program.Title; // creating links with empty text doesn't work
            Description = program.Description;
            StartTime = program.StartTime;
            EndTime = program.EndTime;
            IsScheduled = program.IsScheduled;

            var channel = Connections.Current.TAS.GetChannelDetailedById(program.ChannelId);
            ChannelName = channel.Title;
            ChannelId = channel.Id;
        }
        private string GetPercentageWidth(WebProgramDetailed program, DateTime overallStartTime, DateTime overallEndTime)
        {
            // This should be handled in the controller
            double totalDuration = (overallEndTime - overallStartTime).TotalMinutes;

            double percentage;

            if (program.StartTime <= overallStartTime)
            {
                percentage = 100.0 / totalDuration * (program.EndTime - overallStartTime).TotalMinutes;
            }
            else if (program.EndTime <= overallEndTime)
            {
                percentage = 100.0 / totalDuration * (program.EndTime - program.StartTime).TotalMinutes;
            }
            else
            {
                double width = (overallEndTime - program.StartTime).TotalMinutes;
                percentage = 100.0 / totalDuration * (width < 0 ? 0 : width);
            }

            if (percentage > 100)
            {
                percentage = 100;
            }

            if (percentage < 0)
            {
                percentage = 0;
            }

            return (percentage * 0.99).ToString(System.Globalization.CultureInfo.InvariantCulture) + "%";
        }
示例#11
0
        public TVGuideProgramViewModel(WebProgramDetailed program, DateTime guideStart, DateTime guideEnd)
        {
            Id = program.Id;
            Title = String.IsNullOrEmpty(program.Title) ? UIStrings.Unknown : program.Title; // creating links with empty text doesn't work
            StartTime = program.StartTime;
            EndTime = program.EndTime;
            IsScheduled = program.IsScheduled;

            this.guideStart = guideStart;
            this.guideEnd = guideEnd;
            this.program = program;
        }
示例#12
0
 public TVGuideProgramViewModel(WebProgramDetailed program, DateTime guideStart, DateTime guideEnd)
 {
     Program = program;
     this.guideStart = guideStart;
     this.guideEnd = guideEnd;
 }