private void btnEdit_Click(object sender, EventArgs e) { int idx = listAvailDevices.SelectedIndex; Drone sel = droneList[idx]; var editForm = new frmAddDevices(sel, droneList); editForm.Show(); }
public void loadData() { settingsVal = readSettings(); if (!File.Exists(FILENAME)) { if (!createXmlFile()) { MessageBox.Show("Error creating XML file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var result = MessageBox.Show("Seems this is your first time :), please add device first.", "No devices listed", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); switch (result) { case DialogResult.Yes: var frmAdd = new frmAddDevices(null, null); frmAdd.Show(); frmAdd.TopMost = true; break; case DialogResult.No: break; default: MessageBox.Show("What did you press?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error); break; } } } else { readXmlFile(); var bindingList = new BindingList <Drone>(droneList); var source = new BindingSource(bindingList, null); cmbConnect.DataSource = source; cmbConnect.DisplayMember = "profileName"; } }
private void addDeviceToolStripMenuItem_Click(object sender, EventArgs e) { var addDevices = new frmAddDevices(null, droneList); addDevices.Show(); }