示例#1
0
 private void DeleteSelectedBand()
 {
     if (SelectedItem.ID == null)
     {
         return;
     }
     try
     {
         if (SelectedItem.Delete())
         {
             SelectedItem.PropertyChanged          -= band_PropertyChanged;
             SelectedItem.Genres.CollectionChanged -= BandGenres_CollectionChanged;
             SelectedItem.ID = null;
             List.Remove(SelectedItem);
             SelectedItem = null;
         }
         else
         {
             throw new Exception("Could not remove band");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         MessageBox.Show("Kon band niet verwijderen uit de database, gelieve eerst de optredens van de band te verwijderen.");
     }
 }
示例#2
0
        private void RemoveItem()
        {
            var index = Shortcuts.IndexOf(SelectedItem);

            SelectedItem.Delete();
            Shortcuts.Remove(SelectedItem);
            if ((index + 1) > Shortcuts.Count)
            {
                index--;
            }
            if (Shortcuts.Count != 0)
            {
                SelectedItem = Shortcuts[index];
            }
        }
示例#3
0
 private async Task OnDeleteSelectedItem()
 {
     await SelectedItem.Delete();
 }