private void AdjustTimeSpanbyItem(IRecorderItem item, TimeSpan decreaseTime) { if (IsLastItem(item) || decreaseTime.TotalSeconds == 0) { return; } int startIndex = this.Items.IndexOf(item); //Adjust a timestamp in remained items for (int i = startIndex + 1; i < this.Items.Count; i++) { AbsRecorderItem recorderItem = this.Items[i] as AbsRecorderItem; recorderItem.AdjustTimeSpan(decreaseTime); } }
public bool InsertItem(IRecorderItem prevItem, IRecorderItem newItem) { int startIndex = -1; if (prevItem != null) { startIndex = this.Items.IndexOf(prevItem); } this.Items.Insert(startIndex + 1, newItem); if (OnInsertItem != null) { OnInsertItem(prevItem, newItem); } TimeSpan increaseTimeSec = TimeSpan.FromSeconds(newItem.TotalTimeDurationSec); for (int i = startIndex + 1; i < this.Items.Count; i++) { AbsRecorderItem recorderItem = this.Items[i] as AbsRecorderItem; recorderItem.AdjustTimeSpan(increaseTimeSec); } return(true); }