private void CreateFromSourceBook(Book.Book sourceBook) { try { var newBook = _bookServer.CreateFromSourceBook(sourceBook, TheOneEditableCollection.PathToDirectory); if (newBook == null) { return; //This can happen if there is a configuration dialog and the user clicks Cancel } TheOneEditableCollection.AddBookInfo(newBook.BookInfo); if (_bookSelection != null) { _bookSelection.SelectBook(newBook); } //enhance: would be nice to know if this is a new shell if (sourceBook.IsShellOrTemplate) { Analytics.Track("Create Book", new Dictionary <string, string>() { { "Category", sourceBook.CategoryForUsageReporting } }); } _editBookCommand.Raise(newBook); } catch (Exception e) { Palaso.Reporting.ErrorReport.NotifyUserOfProblem(e, "Bloom ran into an error while creating that book. (Sorry!)"); } }
private void CreateFromSourceBook(Book.Book sourceBook) { var newBook = _bookServer.CreateFromSourceBook(sourceBook, TheOneEditableCollection.PathToDirectory); TheOneEditableCollection.AddBookInfo(newBook.BookInfo); if (_bookSelection != null) { _bookSelection.SelectBook(newBook); } //enhance: would be nice to know if this is a new shell if (sourceBook.IsShellOrTemplate) { Analytics.Track("Create Book", new Dictionary <string, string>() { { "Category", sourceBook.CategoryForUsageReporting } }); } _editBookCommand.Raise(newBook); }
private void CreateFromSourceBook(Book.Book sourceBook) { try { var newBook = _bookServer.CreateFromSourceBook(sourceBook, TheOneEditableCollection.PathToDirectory); if (newBook == null) { return; //This can happen if there is a configuration dialog and the user clicks Cancel } TheOneEditableCollection.AddBookInfo(newBook.BookInfo); if (_bookSelection != null) { Book.Book.SourceToReportForNextRename = Path.GetFileName(sourceBook.FolderPath); _bookSelection.SelectBook(newBook, aboutToEdit: true); } //enhance: would be nice to know if this is a new shell if (sourceBook.IsShellOrTemplate) { Analytics.Track("Create Book", new Dictionary <string, string>() { { "Category", sourceBook.CategoryForUsageReporting }, { "BookId", newBook.ID }, { "Country", _collectionSettings.Country } }); } // Better reported in Book_BookTitleChanged as a side effect of selecting it. // BookHistory.AddEvent(newBook, BookHistoryEventType.Created, "New book created"); _editBookCommand.Raise(newBook); } catch (Exception e) { SIL.Reporting.ErrorReport.NotifyUserOfProblem(e, "Bloom ran into an error while creating that book. (Sorry!)"); } }