private void btnAddAudioTask_Click(object sender, EventArgs e) { var audioForm = new AudioTaskForm(); if (audioForm.ShowDialog() == DialogResult.OK) { m_AudioOutputTaskGroup.Tasks.Add(new AudioOutputTask(audioForm.GetAudioOutputTask())); olvAudioTasks.SetObjects(m_AudioOutputTaskGroup.Tasks); olvAudioTasks.Refresh(); } }
private void btnEditAudioTask_Click(object sender, EventArgs e) { if (olvAudioTasks.SelectedItem != null) { var audioForm = new AudioTaskForm(); var currentItem = olvAudioTasks.SelectedItem.RowObject as AudioOutputTask; audioForm.LoadFromTask(currentItem); if (audioForm.ShowDialog() == DialogResult.OK) { var idx = m_AudioOutputTaskGroup.Tasks.IndexOf(currentItem); if (idx >= 0) { m_AudioOutputTaskGroup.Tasks[idx] = new AudioOutputTask(audioForm.GetAudioOutputTask()); } else { m_AudioOutputTaskGroup.Tasks.Add(new AudioOutputTask(audioForm.GetAudioOutputTask())); } olvAudioTasks.SetObjects(m_AudioOutputTaskGroup.Tasks); olvAudioTasks.Refresh(); } } }