//add s single point protected void PlusSelectedPoint(EditableProgressPoint newPoint) { if (StartSelectedPoint == null) { StartSelectedPoint = newPoint; EndSelectedPoint = newPoint; return; } var startIndex = GetObjectIndex(StartSelectedPoint); var endIndex = GetObjectIndex(EndSelectedPoint); if (GetObjectIndex(newPoint) < startIndex) { StartSelectedPoint = newPoint; } if (GetObjectIndex(newPoint) > endIndex) { EndSelectedPoint = newPoint; } if (startIndex > endIndex) { //switch two point var tempPoint = StartSelectedPoint; StartSelectedPoint = EndSelectedPoint; EndSelectedPoint = tempPoint; } }
/// <summary> /// update UI /// </summary> public void UpdateView() { //1. show the whole bar with start time and end time //2. fix time Lyric.TimeLines.FixTime(); //3. show each point with text start and end time ListEditableProgressPoint.Direction = FillDirection.Horizontal; ListEditableProgressPoint.Clear(); foreach (var single in Lyric.TimeLines) { var editableProgressPoint = new EditableProgressPoint(this, single); ListEditableProgressPoint.Add(editableProgressPoint); } //update position UpdatePosition(); //update color UpdateColor(); }
protected int GetObjectIndex(EditableProgressPoint point) { return(point != null?ListEditableProgressPoint.IndexOf(point) : -1); }