Пример #1
0
 /// <summary>
 /// Tries to delete the selected row
 /// </summary>
 public void DeleteItem(bool deleteRef = false)
 {
     try
     {
         filterableDataGrid.TryDeleteSelected(deleteRef);
         editingSidebar.EmptySidebar();
     }
     // An exception is thrown if there are other items which reference the item to be deleted
     catch (Exception ex)
     {
         // Allow the user to make the choice to delete the item and everything which references it (And everything that references the references, and so on)
         // Or cancel the deletion
         grdFKeyErrorOuter.Visibility = Visibility.Visible;
         tblFKeyRefError.Text         = ex.Message;
     }
 }
Пример #2
0
        /// <summary>
        /// Called by an editing sidebar whenever the user wants to delete an item
        /// </summary>
        internal void DeleteItem(bool deleteRef = false)
        {
            try
            {
                switch (mode)
                {
                case contactString: dtgContacts.TryDeleteSelected(deleteRef); contactEditing.EmptySidebar(); break;

                case dogString: dtgDogs.TryDeleteSelected(deleteRef); dogsEditing.EmptySidebar(); break;

                case clientString: dtgClients.TryDeleteSelected(deleteRef); clientsEditing.EmptySidebar(); break;
                }
            }
            // An exception is thrown if there are other items which reference the item to be deleted
            catch (Exception ex)
            {
                // Allow the user to make the choice to delete the item and everything which references it (And everything that references the references, and so on)
                // Or cancel the deletion
                grdFKeyErrorOuter.Visibility = Visibility.Visible;
                tblFKeyRefError.Text         = ex.Message;
            }
        }