private void OnModifyBook(object sender, RoutedEventArgs e) { if (dgLibrarianDocuments.SelectedIndex != -1 && dgLibrarianDocuments.SelectedItems[0] != null) { DocumentsTable docRow = dgLibrarianDocuments.SelectedItems[0] as DocumentsTable; Window page = null; switch (docRow.docType) { case "Book": page = new ModifyBookPage(docRow.docID, this); break; case "Journal": page = new ModifyJournalPage(docRow.docID, this); break; case "AV": page = new ModifyAVPage(docRow.docID, this); break; default: throw new Exception("Unhandled doc type!"); } page.ShowDialog(); } }
private void AVClick(object sender, RoutedEventArgs e) { if (_add) { AddAVPage page = new AddAVPage(_previousPage); page.ShowDialog(); } else { ModifyAVPage page = new ModifyAVPage(_docID, _previousPage); page.ShowDialog(); } Close(); }