public void AddNewHarmonic(Harmonic harmonic) { _harmonics.Add(harmonic); ActiveHarmonicIndex = _harmonics.Count - 1; HarmonicAdded?.Invoke(ActiveHarmonicIndex); ActiveHarmonicChanged?.Invoke(ActiveHarmonicIndex); }
public void SelectHarmonicByIndex(int index) { if (index >= _harmonics.Count || index < 0) { throw new IndexOutOfRangeException("index out of range"); } ActiveHarmonicIndex = index; ActiveHarmonicChanged?.Invoke(ActiveHarmonicIndex); }
public void DeleteActiveHarmonic() { var index = ActiveHarmonicIndex; if (index == -1) { return; } _harmonics.RemoveAt(index); if (!(ActiveHarmonicIndex == 0 && _harmonics.Count > 0)) { ActiveHarmonicIndex--; } HarmonicDeleted?.Invoke(index); ActiveHarmonicChanged?.Invoke(ActiveHarmonicIndex); }