예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            AddCameraForm f = new AddCameraForm();

            f.FormClosed += F_FormClosed;
            f.ShowDialog(this);
        }
예제 #2
0
        private void F_FormClosed(object sender, FormClosedEventArgs e)
        {
            AddCameraForm f = (AddCameraForm)sender;

            if (f.newCamera == null)
            {
                return;
            }
            lbCameras.Items.Add(f.newCamera);
        }
예제 #3
0
        private void F_FormClosed_Edit(object sender, FormClosedEventArgs e)
        {
            AddCameraForm f = (AddCameraForm)sender;

            if (f.newCamera == null)
            {
                return;
            }
            lbCameras.Items[editingIndex] = f.newCamera;
        }
예제 #4
0
        private void btnEditSelected_Click(object sender, EventArgs e)
        {
            if (lbCameras.SelectedIndices.Count != 1)
            {
                return;
            }
            editingIndex = lbCameras.SelectedIndex;
            CameraDefinition selectedCamera = (CameraDefinition)lbCameras.SelectedItem;

            if (selectedCamera != null)
            {
                AddCameraForm f = new AddCameraForm();
                f.ConvertIntoEditForm(selectedCamera);
                f.FormClosed += F_FormClosed_Edit;
                f.ShowDialog(this);
            }
        }