private void remapPad_Click(object sender, EventArgs e) { var dlg = new RemapPadDialog(mainForm, controller.Index, controller.Device.ProductName); dlg.ShowDialog(this.ParentForm); if (dlg.DialogResult == DialogResult.OK) { controller.DeviceConfig.PadNumber = dlg.PadNumber; mainForm.GlobalConfig.Save(); controller.Index = 0; // this way ReassignPadNumber will not consider the old index as in use // Attempt to associate the new pad number, or pick the lowest free one, and then reload the current // configuration so the mappings work correctly. mainForm.ReassignPadNumber(controller); } }