private void btnAddVideoTask_Click(object sender, EventArgs e) { var videoForm = new VideoTaskForm(); if (videoForm.ShowDialog() == DialogResult.OK) { m_VideoOutputTaskGroup.Tasks.Add(new VideoOutputTask(videoForm.GetVideoOutputTask())); olvVideoTasks.SetObjects(m_VideoOutputTaskGroup.Tasks); olvVideoTasks.Refresh(); } }
private void btnEditVideoTask_Click(object sender, EventArgs e) { if (olvVideoTasks.SelectedItem != null) { var videoForm = new VideoTaskForm(); var currentItem = olvVideoTasks.SelectedItem.RowObject as VideoOutputTask; videoForm.LoadFromTask(currentItem); if (videoForm.ShowDialog() == DialogResult.OK) { var idx = m_VideoOutputTaskGroup.Tasks.IndexOf(currentItem); if (idx >= 0) { m_VideoOutputTaskGroup.Tasks[idx] = new VideoOutputTask(videoForm.GetVideoOutputTask()); } else { m_VideoOutputTaskGroup.Tasks.Add(new VideoOutputTask(videoForm.GetVideoOutputTask())); } olvVideoTasks.SetObjects(m_VideoOutputTaskGroup.Tasks); olvVideoTasks.Refresh(); } } }