Ejemplo n.º 1
0
 /// <summary>
 /// Closing window logic
 /// </summary>
 /// <param name="sender">The source of the event</param>
 /// <param name="e">The instance containing the event data</param>
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (LibraryModel.AreItemsRemoved() || LibraryModel.AreItemsUpdated())
     {
         if (MessageBox.Show("All unsaved changes will be lost. Are you sure you want to exit?", "Exit Program", MessageBoxButton.YesNo) == MessageBoxResult.No)
         {
             e.Cancel = true;
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Exit button logic
 /// </summary>
 /// <param name="sender">The source of the event</param>
 /// <param name="e">The instance containing the event data</param>
 private void Exit_Button_Click(object sender, RoutedEventArgs e)
 {
     if (LibraryModel.AreItemsRemoved() || LibraryModel.AreItemsUpdated())
     {
         if (MessageBox.Show("All unsaved changes will be lost. Are you sure you want to exit?", "Exit Program", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
         {
             LibraryModel.ChangesSaved();
             Close();
         }
     }
     else
     {
         Close();
     }
 }