public void ClearLog(object sender, RoutedEventArgs e) { try { if (DataGrid.SelectedItem != null) { VLogentries log = (VLogentries)DataGrid.SelectedItem; _mainViewModel.ClearLog(log.Id); _mainViewModel.ReadLogList(); } else { MessageBox.Show("Bitte wählen Sie eine Zeile aus.", "Auswahl fehlgeschlagen"); } } catch (Exception ex) { MessageBox.Show("Exception occured: " + ex.Message, "Exception occured"); } }