private void EditOffset(int selected) { // Will need to pass in the currently selected item frmOffset dialog = new frmOffset(frmOffset.Mode.Edit); dialog.SetAmp(offsets[selected].Amplitude); dialog.SetPhase(offsets[selected].Phase); DialogResult r = dialog.ShowDialog(); if (r == DialogResult.OK) { var newPhase = dialog.GetPhase(); var newAmp = dialog.GetAmp(); offsets[selected].Phase = newPhase; offsets[selected].Amplitude = newAmp; lsvOffsets.Items[selected] = CreateListViewItem(offsets[selected]); //grabs selected items from offsets list, stores in listviewitem, adds to listview } }
private void AddOffset() { frmOffset dialog = new frmOffset(frmOffset.Mode.Add); DialogResult r = dialog.ShowDialog(); if (r == DialogResult.OK) { // Add the offset to the listview (lsvOffsets) // Create new variable to hold phase and amplitude values PhaseAmplitudeOffset newOffset = new PhaseAmplitudeOffset { Phase = dialog.GetPhase(), Amplitude = dialog.GetAmp() }; offsets.Add(newOffset); //List<PhaseAmplitudeOffset> offset // create new listview item to store phase/amp values and add to list lsvOffsets.Items.Add(CreateListViewItem(newOffset)); } }