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 newValue = new PhaseAmplitudeOffset { Phase = dialog.getPhase(), Amplitude = dialog.getAmp() }; // create new listview item to store phase/amp values and add to list ListViewItem newItem; string[] arr = new string[2]; arr[0] = newValue.Phase.ToString(); arr[1] = newValue.Amplitude.ToString(); newItem = new ListViewItem(arr); lsvOffsets.Items.Add(newItem); } }
private void AddOffset() { frmOffset dialog = new frmOffset(frmOffset.Mode.Add); DialogResult r = dialog.ShowDialog(); if (r == DialogResult.OK) { // Add the offset to the listview } }
private void EditOffset(int selected) { // Will need to pass in the currently selected item frmOffset dialog = new frmOffset(frmOffset.Mode.Edit); DialogResult r = dialog.ShowDialog(); if (r == DialogResult.OK) { // Edit the offset shown in the listview } }
private void AddOffset() { frmOffset dialog = new frmOffset(frmOffset.Mode.Add); DialogResult r = dialog.ShowDialog(); if (r == DialogResult.OK) { var settings = dialog.GetSettings(); string[] offsetRow = { settings.Phase.ToString(), settings.Amplitude.ToString() }; // Add the offset to the listview var offsetItem = new ListViewItem(offsetRow); this.lsvOffsets.Items.Add(offsetItem); } }
private void AddOffset() { frmOffset dialog = new frmOffset(frmOffset.Mode.Add); DialogResult r = dialog.ShowDialog(); if (r == DialogResult.OK) { PhaseAmplitudeOffset offset = dialog.offset; string[] strValues = new string[2]; strValues[0] = offset.PhaseOffset.ToString(); strValues[1] = offset.AmplitudeOffset.ToString(); // Add the offset to the listview ListViewItem newItem = new ListViewItem(strValues); lsvOffsets.Items.Add(newItem); } }
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 EditOffset(int selected) { // Will need to pass in the currently selected item frmOffset dialog = new frmOffset(frmOffset.Mode.Edit); DialogResult r = dialog.ShowDialog(); if (r == DialogResult.OK) { RemoveOffset(selected); PhaseAmplitudeOffset offset = dialog.offset; string[] strValues = new string[2]; strValues[0] = offset.PhaseOffset.ToString(); strValues[1] = offset.AmplitudeOffset.ToString(); // Edit the offset to the listview ListViewItem newItem = new ListViewItem(strValues); lsvOffsets.Items.Insert(selected, newItem); } }
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)); } }