示例#1
0
        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);
            }
        }
示例#2
0
        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);
        }
示例#3
0
 private TimeSpan GetTimeSpan(AbsRecorderItem item, AbsRecorderItem prevItem)
 {
     return(prevItem.GetVeryLastTime() - item.GetVeryLastTime());
 }