private void Button_Click_2(object sender, RoutedEventArgs e) { if (selectListBox.SelectedItems.Count == 0) { string messgeBoxText = "Unable to import photos. No photos were selected"; string messageBoxCaption = "No Photos Selected."; MessageBoxButton btnMessageBox = MessageBoxButton.OK; MessageBoxImage icnMessageBox = MessageBoxImage.Error; MessageBoxResult rsltMessageBox = MessageBox.Show(messgeBoxText, messageBoxCaption, btnMessageBox, icnMessageBox); } else { string messgeBoxText; if (selectListBox.SelectedItems.Count == 1) { messgeBoxText = "Are you sure you want to import 1 photo?"; } else { messgeBoxText = "Are you sure you want to import " + selectListBox.SelectedItems.Count + " photos?"; } string messageBoxCaption = "Import Photos"; MessageBoxButton btnMessageBox = MessageBoxButton.YesNo; MessageBoxImage icnMessageBox = MessageBoxImage.Question; MessageBoxResult rsltMessageBox = MessageBox.Show(messgeBoxText, messageBoxCaption, btnMessageBox, icnMessageBox); switch (rsltMessageBox) { case MessageBoxResult.Yes: this.Close(); ImportPhotos importPhotosWindow = new ImportPhotos(this, mainWindow); importPhotosWindow.Show(); break; } } }