private void button_Add_Click(object sender, EventArgs e) { var device_dialog = new DeviceEditor(); device_dialog.Data = new JObject(); var result = device_dialog.ShowDialog(); if (result == DialogResult.OK) { ProjectData.Device.Add(device_dialog.Data); Config2UI(); } }
private void button_Edit_Click(object sender, EventArgs e) { if (listView_Device.SelectedItems.Count > 0) { var lvitem = listView_Device.SelectedItems[0]; string UUID = (string)lvitem.Tag; dynamic device_data = FindDeviceByUUID(UUID); // // // var device_dialog = new DeviceEditor(); device_dialog.Data = device_data; var result = device_dialog.ShowDialog(); if (result == DialogResult.OK) { //JObject data = json_decode(json_encode(device_dialog.Data)); UpdateDeviceByUUID((string)device_dialog.Data.UUID, device_dialog.Data); Config2UI(); } } }