private void Create_Click(object sender, RoutedEventArgs e) { Device newDevice = new Device(); DeviceWPF lumberModal = new DeviceWPF(newDevice); if (lumberModal.ShowDialog() == true) { channelWP.AddDevice(newDevice); List.Items.Add(newDevice.ToString()); } else { MessageBox.Show("Changes are not saved"); } }
private void Change_Click(object sender, RoutedEventArgs e) { int selectedIndex = List.SelectedIndex; if (selectedIndex < 0 || selectedIndex >= channelWP.Devices.Count) { MessageBox.Show("Choose!"); return; } DeviceWPF lumberModal = new DeviceWPF(channelWP.Devices[selectedIndex]); if (lumberModal.ShowDialog() == true) { List.Items[selectedIndex] = channelWP.Devices[selectedIndex].ToString(); } else { MessageBox.Show("Changes was not saved"); } }