示例#1
0
        public ITextItem Clone()
        {
            var textGroup = new TextGroup(Separator, BorderLeft, BorderRight);

            textGroup.Items.AddRange(Items.Select(i => i.Clone()));
            return(textGroup);
        }
		public static TextGroup Join(this IEnumerable<ITextItem> textItems, string separator = "", string borderLeft = "", string borderRight = "")
		{
			var textGroup = new TextGroup(separator, borderLeft, borderRight);
			textGroup.Items.AddRange(textItems);
			return textGroup;
		}
		private IEnumerable<MediaDataNote> GetNotesFromSnapshots()
		{
			var notes = new List<MediaDataNote>();

			if (ScheduleSettings.FlightDateStart.HasValue && ScheduleSettings.FlightDateEnd.HasValue)
			{
				var startDate = ScheduleSettings.FlightDateStart.Value;
				var endDate = ScheduleSettings.FlightDateEnd.Value;
				while (startDate < endDate)
				{
					var noteEndDate = startDate.AddDays(6);

					notes.AddRange(Schedule.SnapshotContent.Snapshots
						.Where(s => !s.ActiveWeeks.Any() || s.ActiveWeeks.Any(w => w.StartDate == startDate && w.FinishDate == noteEndDate))
						.Select(s =>
						{
							var textGroup = new TextGroup();
							textGroup.Items.Add(new TextItem(String.Format("{0} - ", s.Name), true));
							var programsText = String.Join(",   ", s.Programs.Select(program =>
								String.Format("{0}{1}  {2}x  {3}",
									s.ShowStation ? String.Format("{0}  ", program.Station) : String.Empty,
									(s.ShowProgram && !String.IsNullOrEmpty(program.Name)) || (s.ShowTime && !String.IsNullOrEmpty(program.Time)) ?
										String.Format("({0}{1})",
											s.ShowProgram && !String.IsNullOrEmpty(program.Name) ? String.Format("{0} ", program.Name) : String.Empty,
											s.ShowTime && !String.IsNullOrEmpty(program.Time) ? String.Format("{0}", program.Time) : String.Empty) :
										String.Empty,
									program.TotalSpots,
									program.StartDayLetter == program.EndDayLetter ?
										program.StartDayLetter :
										String.Format("{0}-{1}", program.StartDayLetter, program.EndDayLetter)
									)
								));
							textGroup.Items.Add(new TextItem(programsText, false));
							return new MediaDataNote(this)
							{
								StartDay = startDate,
								FinishDay = noteEndDate,
								MediaData = textGroup
							};
						})
						);
					startDate = startDate.AddDays(7);
				}
			}
			return notes;
		}
示例#4
0
		public ITextItem Clone()
		{
			var textGroup = new TextGroup(Separator, BorderLeft, BorderRight);
			textGroup.Items.AddRange(Items.Select(i => i.Clone()));
			return textGroup;
		}