public void RemoveSelectedSpan() // removes selected (doh) span { if (Spans.Count <= 2) { return; } int index = Spans.IndexOf(_selectedSpan); _selectedSpan.PropertyChanged -= OnUserSpanPropertyChanged; Spans.Remove(_selectedSpan); OrderingSection(); if (index >= Spans.Count()) { return; // last span was removed so nothing to do } else { OnTowerAbscissaPropertyChanged(Spans[index]); // altering span lengths as a consequence of the tower abscissas change (change of tower abscissa has higher priority than span length) } if (EvaluateNeedToPerformInternalIntegrityCheck()) { CheckInternalIntegrity(); } }
void DeleteSpan(object parameter) { if (Spans.Count > 1) { Spans.Remove(Spans.LastOrDefault()); SelectedSpan = Spans.LastOrDefault(); } }
public void JustRemoveSpan() // removes last span { if (Spans.Count <= 2) { return; } Spans.Last().PropertyChanged -= OnUserSpanPropertyChanged; Spans.Remove(Spans.Last()); OrderingSection(); if (EvaluateNeedToPerformInternalIntegrityCheck()) { CheckInternalIntegrity(); } }
public void ClearBackToBasicSection() { int index = Spans.Count - 1; UserSpan span; if (Spans.Count > 2) { do { span = Spans.Last(); span.PropertyChanged -= OnUserSpanPropertyChanged; Spans.Remove(span); index--; } while (index > 1); } foreach (UserSpan remainingSpan in Spans) { remainingSpan.Clear(); } OrderingSection(); _light = IndicatorLight.None; }