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},
{ "BookId", newBook.ID},
{ "Country", _collectionSettings.Country}
});
}
_editBookCommand.Raise(newBook);
}
catch (Exception e)
{
SIL.Reporting.ErrorReport.NotifyUserOfProblem(e,
"Bloom ran into an error while creating that book. (Sorry!)");
}
}