/// <summary>
 /// Resto in ascolto dei tasti premuti con la griglia attiva
 /// se è premuto il tasto delete lo intercetto e pongo la
 /// domanda se si è sicuri, in caso affermativo elimino la gestione
 /// </summary>
 /// <param name="sender">tastiera</param>
 /// <param name="e">tasto premuto</param>
 public void DeleteRow(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Delete)
     {
         DataGrid dg = sender as DataGrid;
         if (dg.SelectedIndex > 0)
         {
             MessageBoxResult result = MessageBox.Show("Attenzione verrà elemininata la gestione: " +
                                                       ((RegistryOwner)dg.SelectedItem).Nome_Gestione, "DAF-C Gestione Gestioni", MessageBoxButton.YesNo, MessageBoxImage.Question);
             if (result == MessageBoxResult.Yes)
             {
                 try
                 {
                     _services.DeleteGestione(((RegistryOwner)dg.SelectedItem).Id_gestione);
                     OwnerList = new ObservableCollection <RegistryOwner>(_services.GetGestioneList());
                 }
                 catch (Exception err)
                 {
                     MessageBox.Show("Errore nell'eliminazione della gestione: " + Environment.NewLine + err.Message);
                     e.Handled = true;
                 }
             }
             else
             {
                 e.Handled = true;
             }
         }
     }
 }