private void DeleteDevice_Click(object sender, RoutedEventArgs e) { try { MessageBoxResult messageResult = MessageBox.Show("Вы уверены, что хотите удалить это устройство?", "Удаление устройства", MessageBoxButton.YesNo); if (messageResult == MessageBoxResult.Yes) { DeviceLogic.DeleteDevice(); MessageBox.Show("Устройство успешно удалено!"); DeviceListWindow deviceList = new DeviceListWindow(); deviceList.Show(); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ChangeDevice_Click(object sender, RoutedEventArgs e) { try { DeviceModel ChangeDevice = new DeviceModel { Name = NameDevice.Text, Model = ModelDevice.Text, Manufacturer = ManufacturerDevice.Text, DescriptionDevice = DescriptionDevice.Text }; DeviceLogic.ChangeDevice(ChangeDevice); MessageBox.Show("Информация об устройсте успешно изменена"); DeviceListWindow deviceList = new DeviceListWindow(); deviceList.Show(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void AddDevice_Click(object sender, RoutedEventArgs e) { try { DeviceModel NewDevice = new DeviceModel { Name = NameDevice.Text, Model = ModelDevice.Text, Manufacturer = ManufacturerDevice.Text, DescriptionDevice = DescriptionDevice.Text }; DeviceLogic.RegistrationDevice(NewDevice); MessageBox.Show("Устройство успешно добавлено!"); DeviceListWindow deviceList = new DeviceListWindow(); deviceList.Show(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }