ExtensionIsApplicable() public static method

public static ExtensionIsApplicable ( Book book ) : bool
book Bloom.Book.Book
return bool
Example #1
0
 public IEnumerable <ToolStripItem> GetExtensionMenuItems()
 {
     //for now we're not doing real extension dlls, just kind of faking it. So we will limit this load
     //to books we know go with this currently "built-in" "extension" for SIL LEAD's SHRP Project.
     if (SHRP_PupilBookExtension.ExtensionIsApplicable(BookSelection.CurrentSelection))
     {
         //load any extension assembly found in the template's root directory
         //var catalog = new DirectoryCatalog(this.BookSelection.CurrentSelection.FindTemplateBook().FolderPath, "*.dll");
         var catalog   = new AssemblyCatalog(Assembly.GetExecutingAssembly());
         var container = new CompositionContainer(catalog);
         //inject what we have to offer for the extension to consume
         container.ComposeExportedValue <string>("PathToBookFolder", BookSelection.CurrentSelection.FolderPath);
         container.ComposeExportedValue <string>("Language1Iso639Code", _currentlyLoadedBook.BookData.Language1.Iso639Code);
         container.ComposeExportedValue <Func <IEnumerable <HtmlDom> > >(GetPageDoms);
         //  container.ComposeExportedValue<Func<string>>("pathToPublishedHtmlFile",GetFileForPrinting);
         //get the original images, not compressed ones (just in case the thumbnails are, like, full-size & they want quality)
         container.ComposeExportedValue <Action <int, int, HtmlDom, Action <Image>, Action <Exception> > >(GetThumbnailAsync);
         container.SatisfyImportsOnce(this);
         return(_getExtensionMenuItems == null ? new List <ToolStripItem>() : _getExtensionMenuItems());
     }
     else
     {
         return(new List <ToolStripMenuItem>());
     }
 }
 public IEnumerable <ToolStripItem> GetExtensionMenuItems()
 {
     //for now we're not doing real extension dlls, just kind of faking it. So we will limit this load
     //to books we know go with this currently "built-in" "extension" for SIL LEAD's SHRP Project.
     //TODO: this should work, but it doesn't because BookInfo.BookLineage isn't working: if (SHRP_PupilBookExtension.ExtensionIsApplicable(BookSelection.CurrentSelection.BookInfo.BookLineage))
     if (SHRP_PupilBookExtension.ExtensionIsApplicable(BookSelection.CurrentSelection.GetBookLineage()))
     {
         //load any extension assembly found in the template's root directory
         //var catalog = new DirectoryCatalog(this.BookSelection.CurrentSelection.FindTemplateBook().FolderPath, "*.dll");
         var catalog   = new AssemblyCatalog(Assembly.GetExecutingAssembly());
         var container = new CompositionContainer(catalog);
         //inject what we have to offer for the extension to consume
         container.ComposeExportedValue <string>("PathToBookFolder", BookSelection.CurrentSelection.FolderPath);
         container.ComposeExportedValue <string>("Language1Iso639Code", _collectionSettings.Language1Iso639Code);
         container.ComposeExportedValue <Func <IEnumerable <HtmlDom> > >(GetPageDoms);
         //  container.ComposeExportedValue<Func<string>>("pathToPublishedHtmlFile",GetFileForPrinting);
         container.ComposeExportedValue <Action <int, int, HtmlDom, Action <Image>, Action <Exception> > >(GetThumbnailAsync);
         container.SatisfyImportsOnce(this);
         return(_getExtensionMenuItems == null ? new List <ToolStripItem>() : _getExtensionMenuItems());
     }
     else
     {
         return(new List <ToolStripMenuItem>());
     }
 }