コード例 #1
0
 private void DeleteExecute()
 {
     try
     {
         if (Sector != null)
         {
             DeleteSectorView deleteSector = new DeleteSectorView();
             deleteSector.ShowDialog();
             if ((deleteSector.DataContext as DeleteSectorViewModel).ShouldDelete == true)
             {
                 bool isdeleted = companyDB.TryDeleteSector(Sector.SectorID);
                 if (isdeleted)
                 {
                     Sectors = LoadSectors();
                     MessageBox.Show("You have successfully deleted the sector.");
                 }
                 else
                 {
                     MessageBox.Show("Something went wrong. Sector is not deleted.");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
 public DeleteSectorViewModel(DeleteSectorView deleteSector)
 {
     this.deleteSector = deleteSector;
 }