Esempio n. 1
0
 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);
     }
 }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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);
            }
        }