コード例 #1
0
        private void addDevice_Click(object sender, EventArgs e)
        {
            AddDevice addDeviceForm = new AddDevice();

            if (addDeviceForm.ShowDialog() == DialogResult.OK)
            {
                Device device = addDeviceForm.device;
                Controller.driverManager.addDevice(device);
                deviceListBox.Items.Add(device);
                stateChangeResponse();
            }
        }
コード例 #2
0
        private void deviceListBox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListBox   listBox       = sender as ListBox;
            Device    device        = (Device)listBox.SelectedItem;
            AddDevice addDeviceForm = new AddDevice();

            if (addDeviceForm.ShowDialog() == DialogResult.OK)
            {
                deviceListBox.Items.Remove(deviceListBox.SelectedItem);
                Controller.driverManager.deleteDevice((Device)listBox.SelectedItem);

                device = addDeviceForm.device;

                Controller.driverManager.addDevice(device);
                deviceListBox.Items.Add(addDeviceForm.device);

                stateChangeResponse();
            }
        }