/// <summary> /// 添加时间标签到时间标签列表 /// </summary> /// <param name="label"></param> public void AddTimeLabel(TimeLabel label) { if (_fileOperation == FileOperation.OpenWithReadOnly) { throw new WaveformFileException(ErrorCode.CannotCall); } if (TimeLabels.FindIndex(t => t.Name == label.Name) >= 0) //不允许添加相同名字的标签 { throw new WaveformFileException(ErrorCode.SameLabel); } TimeLabels.Add(label);//添加到时间标签列表 }
/// <summary> /// 添加时间标签到时间标签列表 /// </summary> /// <param name="name"></param> /// <param name="position"></param> /// <param name="time"></param> /// <param name="description"></param> public void AddTimeLabel(string name, long position, DateTime time, string description) { if (_fileOperation == FileOperation.OpenWithReadOnly) { throw new WaveformFileException(ErrorCode.CannotCall); } TimeLabel label = new TimeLabel(name, position, time, description); if (TimeLabels.FindIndex(t => t.Name == name) >= 0) //不允许添加相同名字的标签 { throw new WaveformFileException(ErrorCode.SameLabel); } TimeLabels.Add(label);//添加到时间标签列表 }