Exemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            AddCameraForm f = new AddCameraForm();

            f.FormClosed += F_FormClosed;
            f.ShowDialog(this);
        }
Exemplo n.º 2
0
        private void F_FormClosed(object sender, FormClosedEventArgs e)
        {
            AddCameraForm f = (AddCameraForm)sender;

            if (f.newCamera == null)
            {
                return;
            }
            lbCameras.Items.Add(f.newCamera);
        }
Exemplo n.º 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;
        }
Exemplo n.º 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);
            }
        }