private void ScheduledPagesChanged(IPageSchedule[] OldValue, IPageSchedule[] NewValue) { Timer_EarlyVideoStarter.Stop(); Timer_PageChanger.Stop(); BufferedPages.Clear(); if (Pages == null || Pages.Length == 0) return; TimeSpan timeOfDay = DateTime.Now.TimeOfDay; for (int i = 0; i < Pages.Length; i++) { if (Pages[i].IStartTime < timeOfDay) continue; if (Pages[i].IStartTime == timeOfDay) { nextElementToInsertIndex = i-1; break; } nextElementToInsertIndex = i - 1 -1;//cause GetNextRingElementToInsert increases by one break; } BufferedPages.Insert(0, GetNextRingElementToInsert()); BufferedPages.Insert(0, GetNextRingElementToInsert()); BufferedPages.Insert(0, GetNextRingElementToInsert()); Action startAction = () => { Start_Videos_ForCurrentPage(); Start_Animations_ForCurrentPlayingPage(); Start_Timers(); }; if (!IsLoaded) { Loaded += (sender, args) => startAction(); } else { startAction(); } }
/// <summary> /// This method copy's each database field which is in the <paramref name="includedColumns"/> /// from the <paramref name="source"/> interface to this data row. /// </summary> public void Copy_From_But_TakeOnly(IPageSchedule source, params string[] includedColumns) { if (includedColumns.Contains(PageSchedulesTable.IdCol)) this.Id = source.Id; if (includedColumns.Contains(PageSchedulesTable.DiagnosticTextCol)) this.DiagnosticText = source.DiagnosticText; if (includedColumns.Contains(PageSchedulesTable.RingMetaDataIdCol)) this.RingMetaDataId = source.RingMetaDataId; if (includedColumns.Contains(PageSchedulesTable.PageIdCol)) this.PageId = source.PageId; if (includedColumns.Contains(PageSchedulesTable.PageGroupScheduleIdCol)) this.PageGroupScheduleId = source.PageGroupScheduleId; if (includedColumns.Contains(PageSchedulesTable.SlotIdCol)) this.SlotId = source.SlotId; if (includedColumns.Contains(PageSchedulesTable.StartTimeCol)) this.StartTime = source.StartTime; }
/// <summary> This method copy's each database field from the <paramref name="source"/> interface to this data row.</summary> public void Copy_From(IPageSchedule source, bool includePrimaryKey = false) { if (includePrimaryKey) this.Id = source.Id; this.DiagnosticText = source.DiagnosticText; this.RingMetaDataId = source.RingMetaDataId; this.PageId = source.PageId; this.PageGroupScheduleId = source.PageGroupScheduleId; this.SlotId = source.SlotId; this.StartTime = source.StartTime; }
/// <summary> This method copy's each database field into the <paramref name="target"/> interface. </summary> public void Copy_To(IPageSchedule target, bool includePrimaryKey = false) { if (includePrimaryKey) target.Id = this.Id; target.DiagnosticText = this.DiagnosticText; target.RingMetaDataId = this.RingMetaDataId; target.PageId = this.PageId; target.PageGroupScheduleId = this.PageGroupScheduleId; target.SlotId = this.SlotId; target.StartTime = this.StartTime; }