Пример #1
0
 public void AddNewHarmonic(Harmonic harmonic)
 {
     _harmonics.Add(harmonic);
     ActiveHarmonicIndex = _harmonics.Count - 1;
     HarmonicAdded?.Invoke(ActiveHarmonicIndex);
     ActiveHarmonicChanged?.Invoke(ActiveHarmonicIndex);
 }
Пример #2
0
        public void SelectHarmonicByIndex(int index)
        {
            if (index >= _harmonics.Count || index < 0)
            {
                throw new IndexOutOfRangeException("index out of range");
            }

            ActiveHarmonicIndex = index;
            ActiveHarmonicChanged?.Invoke(ActiveHarmonicIndex);
        }
Пример #3
0
        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);
        }