/// <summary> /// In xmatter, text fields are normally labeled with a "meta" language code, like "N1" for first national language. /// This method detects those and then looks them up, returning the actual language code in use at the moment. /// </summary> /// <remarks>This is a little uncomfortable in this class, as this feature is not currently used in any /// bloom-translationGroup elements. /// </remarks> public static void SetLanguageForElementsWithMetaLanguage(XmlNode elementOrDom, CollectionSettings settings) { // foreach (XmlElement element in elementOrDom.SafeSelectNodes(".//*[@data-metalanguage]")) // { // string lang = ""; // string metaLanguage = element.GetStringAttribute("data-metalanguage").Trim(); // switch (metaLanguage) // { // case "V": // lang = settings.Language1Iso639Code; // break; // case "N1": // lang = settings.Language2Iso639Code; // break; // case "N2": // lang = settings.Language3Iso639Code; // break; // default: // var msg = "Element called for meta language '" + metaLanguage + "', which is unrecognized."; // Debug.Fail(msg); // Logger.WriteEvent(msg); // continue; // break; // } // element.SetAttribute("lang", lang); // // // As an aside: if the field also has a class "bloom-copyFromOtherLanguageIfNecessary", then elsewhere we will copy from the old // // national language (or regional, or whatever) to this one if necessary, so as not to lose what they had before. // // } }
public ApiRequest(IRequestInfo requestinfo, CollectionSettings currentCollectionSettings, Book.Book currentBook) { _requestInfo = requestinfo; CurrentCollectionSettings = currentCollectionSettings; CurrentBook = currentBook; Parameters = requestinfo.GetQueryParameters(); }
public static bool FontSettingsLinkClicked(CollectionSettings settings, string langName, int langNum1Based) { var langSpec = settings.LanguagesZeroBased[langNum1Based - 1]; using (var frm = new ScriptSettingsDialog()) { frm.LanguageName = langName; frm.LanguageRightToLeft = langSpec.IsRightToLeft; frm.LanguageLineSpacing = langSpec.LineHeight; frm.UIFontSize = langSpec.BaseUIFontSizeInPoints; frm.BreakLinesOnlyAtSpaces = langSpec.BreaksLinesOnlyAtSpaces; frm.ShowDialog(); // get the changes // We usually don't need to restart, just gather the changes up. The caller // will save the .bloomCollection file. Later when a book // is edited, defaultLangStyles.css will be written out in the book's folder, which is all // that is needed for this setting to take effect. langSpec.LineHeight = frm.LanguageLineSpacing; langSpec.BreaksLinesOnlyAtSpaces = frm.BreakLinesOnlyAtSpaces; langSpec.BaseUIFontSizeInPoints = frm.UIFontSize; if (frm.LanguageRightToLeft != langSpec.IsRightToLeft) { langSpec.IsRightToLeft = frm.LanguageRightToLeft; return(true); } return(false); } }
public void BringBookUpToDate_ConvertsTagsToJsonWithExpectedDefaults() { var storage = GetInitialStorage(); var locator = (FileLocator) storage.GetFileLocator(); string root = FileLocator.GetDirectoryDistributedWithApplication(BloomFileLocator.BrowserRoot); locator.AddPath(root.CombineForPath("bookLayout")); var folder = storage.FolderPath; var tagsPath = Path.Combine(folder, "tags.txt"); File.WriteAllText(tagsPath, "suitableForMakingShells\nexperimental\nfolio\n"); var collectionSettings = new CollectionSettings(new NewCollectionSettings() { PathToSettingsFile = CollectionSettings.GetPathForNewSettings(folder, "test"), Language1Iso639Code = "xyz", Language2Iso639Code = "en", Language3Iso639Code = "fr" }); var book = new Bloom.Book.Book(new BookInfo(folder, true), storage, new Mock<ITemplateFinder>().Object, collectionSettings, new Mock<PageSelection>().Object, new PageListChangedEvent(), new BookRefreshEvent()); book.BringBookUpToDate(new NullProgress()); Assert.That(!File.Exists(tagsPath), "The tags.txt file should have been removed"); // BL-2163, we are no longer migrating suitableForMakingShells Assert.That(storage.MetaData.IsSuitableForMakingShells, Is.False); Assert.That(storage.MetaData.IsFolio, Is.True); Assert.That(storage.MetaData.IsExperimental, Is.True); Assert.That(storage.MetaData.BookletMakingIsAppropriate, Is.True); Assert.That(storage.MetaData.AllowUploading, Is.True); }
public void Setup() { var library = new Moq.Mock<CollectionSettings>(); library.SetupGet(x => x.IsSourceCollection).Returns(false); library.SetupGet(x => x.Language2Iso639Code).Returns("en"); library.SetupGet(x => x.Language1Iso639Code).Returns("xyz"); library.SetupGet(x => x.XMatterPackName).Returns("Factory"); ErrorReport.IsOkToInteractWithUser = false; _fileLocator = new FileLocator(new string[] { //FileLocator.GetDirectoryDistributedWithApplication( "factoryCollections"), BloomFileLocator.GetFactoryBookTemplateDirectory("Basic Book"), BloomFileLocator.GetFactoryBookTemplateDirectory("Wall Calendar"), FileLocator.GetDirectoryDistributedWithApplication( BloomFileLocator.BrowserRoot), BloomFileLocator.GetBrowserDirectory("bookLayout"), BloomFileLocator.GetBrowserDirectory("bookEdit","css"), BloomFileLocator.GetInstalledXMatterDirectory() }); var projectFolder = new TemporaryFolder("BookStarterTests_ProjectCollection"); var collectionSettings = new CollectionSettings(Path.Combine(projectFolder.Path, "test.bloomCollection")); _starter = new BookStarter(_fileLocator, dir => new BookStorage(dir, _fileLocator, new BookRenamedEvent(), collectionSettings), library.Object); _shellCollectionFolder = new TemporaryFolder("BookStarterTests_ShellCollection"); _libraryFolder = new TemporaryFolder("BookStarterTests_LibraryCollection"); }
public static bool Handle(EndpointRegistration endpointRegistration, IRequestInfo info, CollectionSettings collectionSettings, Book.Book currentBook) { var request = new ApiRequest(info, collectionSettings, currentBook); try { if(Program.RunningUnitTests) { endpointRegistration.Handler(request); } else { var formForSynchronizing = Application.OpenForms.Cast<Form>().Last(); if (endpointRegistration.HandleOnUIThread && formForSynchronizing.InvokeRequired) { formForSynchronizing.Invoke(endpointRegistration.Handler, request); } else { endpointRegistration.Handler(request); } } if(!info.HaveOutput) { throw new ApplicationException(string.Format("The EndpointHandler for {0} never called a Succeeded(), Failed(), or ReplyWith() Function.", info.RawUrl.ToString())); } } catch (Exception e) { SIL.Reporting.ErrorReport.ReportNonFatalExceptionWithMessage(e, info.RawUrl); return false; } return true; }
public static void AddUIDictionaryToDom(HtmlDom pageDom, CollectionSettings collectionSettings) { XmlElement dictionaryScriptElement = pageDom.RawDom.SelectSingleNode("//script[@id='ui-dictionary']") as XmlElement; if (dictionaryScriptElement != null) dictionaryScriptElement.ParentNode.RemoveChild(dictionaryScriptElement); dictionaryScriptElement = pageDom.RawDom.CreateElement("script"); dictionaryScriptElement.SetAttribute("type", "text/javascript"); dictionaryScriptElement.SetAttribute("id", "ui-dictionary"); var d = new Dictionary<string, string>(); d.Add(collectionSettings.Language1Iso639Code, collectionSettings.Language1Name); if (!String.IsNullOrEmpty(collectionSettings.Language2Iso639Code) && !d.ContainsKey(collectionSettings.Language2Iso639Code)) d.Add(collectionSettings.Language2Iso639Code, collectionSettings.GetLanguage2Name(collectionSettings.Language2Iso639Code)); if (!String.IsNullOrEmpty(collectionSettings.Language3Iso639Code) && !d.ContainsKey(collectionSettings.Language3Iso639Code)) d.Add(collectionSettings.Language3Iso639Code, collectionSettings.GetLanguage3Name(collectionSettings.Language3Iso639Code)); d.Add("vernacularLang", collectionSettings.Language1Iso639Code);//use for making the vernacular the first tab d.Add("{V}", collectionSettings.Language1Name); d.Add("{N1}", collectionSettings.GetLanguage2Name(collectionSettings.Language2Iso639Code)); d.Add("{N2}", collectionSettings.GetLanguage3Name(collectionSettings.Language3Iso639Code)); AddLocalizedHintContentsToDictionary(pageDom, d, collectionSettings); dictionaryScriptElement.InnerText = String.Format("function GetDictionary() {{ return {0};}}", JsonConvert.SerializeObject(d)); pageDom.Head.InsertAfter(dictionaryScriptElement, pageDom.Head.LastChild); }
//autofac uses this public EditingModel(BookSelection bookSelection, PageSelection pageSelection, LanguageSettings languageSettings, TemplateInsertionCommand templateInsertionCommand, PageListChangedEvent pageListChangedEvent, RelocatePageEvent relocatePageEvent, BookRefreshEvent bookRefreshEvent, DeletePageCommand deletePageCommand, SelectedTabChangedEvent selectedTabChangedEvent, SelectedTabAboutToChangeEvent selectedTabAboutToChangeEvent, LibraryClosing libraryClosingEvent, CollectionSettings collectionSettings, SendReceiver sendReceiver) { _bookSelection = bookSelection; _pageSelection = pageSelection; _languageSettings = languageSettings; _deletePageCommand = deletePageCommand; _collectionSettings = collectionSettings; _sendReceiver = sendReceiver; bookSelection.SelectionChanged += new EventHandler(OnBookSelectionChanged); pageSelection.SelectionChanged += new EventHandler(OnPageSelectionChanged); templateInsertionCommand.InsertPage += new EventHandler(OnInsertTemplatePage); bookRefreshEvent.Subscribe((book) => OnBookSelectionChanged(null, null)); selectedTabChangedEvent.Subscribe(OnTabChanged); selectedTabAboutToChangeEvent.Subscribe(OnTabAboutToChange); deletePageCommand.Implementer=OnDeletePage; pageListChangedEvent.Subscribe(x => _view.UpdatePageList(false)); relocatePageEvent.Subscribe(OnRelocatePage); libraryClosingEvent.Subscribe(o=>SaveNow()); _contentLanguages = new List<ContentLanguage>(); }
//autofac uses this public BookStarter(IChangeableFileLocator fileLocator, BookStorage.Factory bookStorageFactory, CollectionSettings collectionSettings) { _fileLocator = fileLocator; _bookStorageFactory = bookStorageFactory; _collectionSettings = collectionSettings; _isSourceCollection = collectionSettings.IsSourceCollection; }
public static int Handle(HydrateParameters options) { if (!Directory.Exists(options.Path)) { if (options.Path.Contains(".htm")) { Debug.WriteLine("Supply only the directory, not the path to the file."); Console.Error.WriteLine("Supply only the directory, not the path to the file."); } else { Debug.WriteLine("Could not find " + options.Path); Console.Error.WriteLine("Could not find " + options.Path); } return 1; } Console.WriteLine("Starting Hydrating."); var layout = new Layout { SizeAndOrientation = SizeAndOrientation.FromString(options.SizeAndOrientation) }; var collectionSettings = new CollectionSettings { XMatterPackName = "Video", Language1Iso639Code = options.VernacularIsoCode, Language2Iso639Code = options.NationalLanguage1IsoCode, Language3Iso639Code = options.NationalLanguage2IsoCode }; XMatterPackFinder xmatterFinder = new XMatterPackFinder(new[] { BloomFileLocator.GetInstalledXMatterDirectory() }); var locator = new BloomFileLocator(collectionSettings, xmatterFinder, ProjectContext.GetFactoryFileLocations(), ProjectContext.GetFoundFileLocations(), ProjectContext.GetAfterXMatterFileLocations()); var bookInfo = new BookInfo(options.Path, true); var book = new Book.Book(bookInfo, new BookStorage(options.Path, locator, new BookRenamedEvent(), collectionSettings), null, collectionSettings, null, null, new BookRefreshEvent()); if (null == book.OurHtmlDom.SelectSingleNodeHonoringDefaultNS("//script[contains(text(),'bloomPlayer.js')]")) { var element = book.OurHtmlDom.Head.AppendChild(book.OurHtmlDom.RawDom.CreateElement("script")) as XmlElement; element.IsEmpty = false; element.SetAttribute("type", "text/javascript"); element.SetAttribute("src", "bloomPlayer.js"); } AddRequisiteJsFiles(options.Path); //we might change this later, or make it optional, but for now, this will prevent surprises to processes //running this CLI... the folder name won't change out from under it. book.LockDownTheFileAndFolderName = true; book.SetLayout(layout); book.BringBookUpToDate(new NullProgress()); Console.WriteLine("Finished Hydrating."); Debug.WriteLine("Finished Hydrating."); return 0; }
public BloomServer(CollectionSettings collectionSettings, BookCollection booksInProjectLibrary, SourceCollectionsList sourceCollectionsesList, BookThumbNailer thumbNailer) : base(new RuntimeImageProcessor(new BookRenamedEvent()), thumbNailer) { _collectionSettings = collectionSettings; _booksInProjectLibrary = booksInProjectLibrary; _sourceCollectionsesList = sourceCollectionsesList; }
public BloomServer(CollectionSettings collectionSettings, BookCollection booksInProjectLibrary, SourceCollectionsList sourceCollectionsesList, HtmlThumbNailer thumbNailer) { _collectionSettings = collectionSettings; _booksInProjectLibrary = booksInProjectLibrary; _sourceCollectionsesList = sourceCollectionsesList; _thumbNailer = thumbNailer; }
/// <param name="dom">Set this parameter to, say, a page that the user just edited, to limit reading to it, so its values don't get overriden by previous pages. /// Supply the whole dom if nothing has priority (which will mean the data-div will win, because it is first)</param> /// <param name="collectionSettings"> </param> /// <param name="updateImgNodeCallback">This is a callback so as not to introduce dependencies on ImageUpdater & the current folder path</param> public BookData(HtmlDom dom, CollectionSettings collectionSettings, Action<XmlElement> updateImgNodeCallback) { _dom = dom; _updateImgNode = updateImgNodeCallback; _collectionSettings = collectionSettings; GetOrCreateDataDiv(); _dataset = GatherDataItemsFromCollectionSettings(_collectionSettings); GatherDataItemsFromXElement(_dataset,_dom.RawDom); }
//review: is this even used, since we override GetSearchPaths()? public BloomFileLocator(CollectionSettings collectionSettings, XMatterPackFinder xMatterPackFinder, IEnumerable<string> factorySearchPaths, IEnumerable<string> userInstalledSearchPaths) : base(factorySearchPaths.Concat( userInstalledSearchPaths)) { _bookSpecificSearchPaths = new List<string>(); _collectionSettings = collectionSettings; _xMatterPackFinder = xMatterPackFinder; _factorySearchPaths = factorySearchPaths; _userInstalledSearchPaths = userInstalledSearchPaths;; }
public Shell(Func<WorkspaceView> projectViewFactory, CollectionSettings collectionSettings, BookDownloadStartingEvent bookDownloadStartingEvent, LibraryClosing libraryClosingEvent, QueueRenameOfCollection queueRenameOfCollection, ControlKeyEvent controlKeyEvent) { queueRenameOfCollection.Subscribe(newName => _nameToChangeCollectionUponClosing = newName.Trim().SanitizeFilename('-')); _collectionSettings = collectionSettings; _libraryClosingEvent = libraryClosingEvent; _controlKeyEvent = controlKeyEvent; InitializeComponent(); //bring the application to the front (will normally be behind the user's web browser) bookDownloadStartingEvent.Subscribe((x) => { try { this.Invoke((Action)this.Activate); } catch (Exception e) { Debug.Fail("(Debug Only) Can't bring to front in the current state: " + e.Message); //swallow... so we were in some state that we couldn't come to the front... that's ok. } }); #if DEBUG WindowState = FormWindowState.Normal; //this.FormBorderStyle = FormBorderStyle.None; //fullscreen Size = new Size(1024,720); #else // We only want this screen size context menu in Debug mode ContextMenuStrip = null; #endif _workspaceView = projectViewFactory(); _workspaceView.CloseCurrentProject += ((x, y) => { UserWantsToOpenADifferentProject = true; Close(); }); _workspaceView.ReopenCurrentProject += ((x, y) => { UserWantsToOpeReopenProject = true; Close(); }); _workspaceView.BackColor = System.Drawing.Color.FromArgb(64,64,64); _workspaceView.Dock = System.Windows.Forms.DockStyle.Fill; this.Controls.Add(this._workspaceView); SetWindowText(null); }
//, bool inShellMode) public static void SetupPage(XmlElement pageDiv, CollectionSettings collectionSettings, string contentLanguageIso1, string contentLanguageIso2) { TranslationGroupManager.PrepareElementsInPageOrDocument(pageDiv, collectionSettings); // a page might be "extra" as far as the template is concerned, but // once a page is inserted into book (which may become a shell), it's // just a normal page pageDiv.SetAttribute("data-page", pageDiv.GetAttribute("data-page").Replace("extra", "").Trim()); ClearAwayDraftText(pageDiv); }
/// <summary> /// For each group of editable elements in the div which have lang attributes (normally, a .bloom-translationGroup div), /// make a new element with the lang code of the vernacular (normally, a .bloom-editable). /// Also enable/disable editing as warranted (e.g. in shell mode or not) /// </summary> public static void PrepareElementsInPageOrDocument(XmlNode pageOrDocumentNode, CollectionSettings collectionSettings) { PrepareElementsOnPageOneLanguage(pageOrDocumentNode, collectionSettings.Language1Iso639Code); PrepareElementsOnPageOneLanguage(pageOrDocumentNode, collectionSettings.Language2Iso639Code); if (!string.IsNullOrEmpty(collectionSettings.Language3Iso639Code)) { PrepareElementsOnPageOneLanguage(pageOrDocumentNode, collectionSettings.Language3Iso639Code); } }
/// <summary> /// If the collection has no reader tools at all, or if ones that came with the program are newer, /// copy the ones that came with the program. /// This is language-dependent, we'll typically only overwrite settings for an English collection. /// </summary> /// <param name="settings"></param> public static void CopyRelevantNewReaderSettings(CollectionSettings settings) { var readerToolsPath = GetReaderToolsSettingsFilePath(settings); var bloomFolder = ProjectContext.GetBloomAppDataFolder(); var newReaderTools = Path.Combine(bloomFolder, Path.GetFileName(readerToolsPath)); if (!RobustFile.Exists(newReaderTools)) return; if (RobustFile.Exists(readerToolsPath) && RobustFile.GetLastWriteTime(readerToolsPath) > RobustFile.GetLastWriteTime(newReaderTools)) return; // don't overwrite newer existing settings? RobustFile.Copy(newReaderTools, readerToolsPath, true); }
public PublishModel(BookSelection bookSelection, PdfMaker pdfMaker, CurrentEditableCollectionSelection currentBookCollectionSelection, CollectionSettings collectionSettings, BookServer bookServer) { BookSelection = bookSelection; _pdfMaker = pdfMaker; //_pdfMaker.EngineChoice = collectionSettings.PdfEngineChoice; _currentBookCollectionSelection = currentBookCollectionSelection; ShowCropMarks=false; _collectionSettings = collectionSettings; _bookServer = bookServer; bookSelection.SelectionChanged += new EventHandler(OnBookSelectionChanged); BookletPortion = BookletPortions.BookletPages; }
//, bool inShellMode) /// <summary> /// For each group of editable elements in the div which have lang attributes, make a new element /// with the lang code of the vernacular. /// Also enable/disable editting as warranted (e.g. in shell mode or not) /// </summary> /// <param name="node"></param> public static void PrepareElementsInPageOrDocument(XmlNode node, CollectionSettings collectionSettings) { PrepareElementsOnPageOneLanguage(node, collectionSettings.Language1Iso639Code); //why do this? well, for bilingual/trilingual stuff (e.g., a picture dictionary) PrepareElementsOnPageOneLanguage(node, collectionSettings.Language2Iso639Code); if (!string.IsNullOrEmpty(collectionSettings.Language3Iso639Code)) { PrepareElementsOnPageOneLanguage(node, collectionSettings.Language3Iso639Code); } }
public CollectionSettingsDialog(CollectionSettings collectionSettings, XMatterPackFinder xmatterPackFinder, QueueRenameOfCollection queueRenameOfCollection, PageRefreshEvent pageRefreshEvent) { _collectionSettings = collectionSettings; _xmatterPackFinder = xmatterPackFinder; _queueRenameOfCollection = queueRenameOfCollection; _pageRefreshEvent = pageRefreshEvent; InitializeComponent(); // moved from the Designer where it was deleted if the Designer was touched _xmatterList.Columns.AddRange(new[] { new ColumnHeader() { Width = 250 } }); if (_collectionSettings.IsSourceCollection) { _language1Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language1InSourceCollection", "Language 1", "In a local language collection, we say 'Local Language', but in a source collection, Local Language has no relevance, so we use this different label"); _language2Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language2InSourceCollection", "Language 2", "In a local language collection, we say 'Language 2 (e.g. National Language)', but in a source collection, National Language has no relevance, so we use this different label"); _language3Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language3InSourceCollection", "Language 3", "In a local language collection, we say 'Language 3 (e.g. Regional Language)', but in a source collection, National Language has no relevance, so we use this different label"); } _showExperimentalFeatures.Checked = Settings.Default.ShowExperimentalFeatures; // AutoUpdate applies only to Windows: see https://silbloom.myjetbrains.com/youtrack/issue/BL-2317. if (SIL.PlatformUtilities.Platform.IsWindows) { _automaticallyUpdate.Checked = Settings.Default.AutoUpdate; } else { _automaticallyUpdate.Hide(); } // _showSendReceive.CheckStateChanged += (sender, args) => // { // Settings.Default.ShowSendReceive = _showSendReceive.CheckState == // CheckState.Checked; // // _restartRequired = true; // UpdateDisplay(); // }; CollectionSettingsApi.BrandingChangeHandler = ChangeBranding; SetupEnterpriseBrowser(); UpdateDisplay(); if (CollectionSettingsApi.FixEnterpriseSubscriptionCodeMode) { _tab.SelectedTab = _enterpriseTab; } }
public static void AddUIDictionaryToDom(HtmlDom pageDom, CollectionSettings collectionSettings) { CheckDynamicStrings(); // add dictionary script to the page XmlElement dictionaryScriptElement = pageDom.RawDom.SelectSingleNode("//script[@id='ui-dictionary']") as XmlElement; if (dictionaryScriptElement != null) dictionaryScriptElement.ParentNode.RemoveChild(dictionaryScriptElement); dictionaryScriptElement = pageDom.RawDom.CreateElement("script"); dictionaryScriptElement.SetAttribute("type", "text/javascript"); dictionaryScriptElement.SetAttribute("id", "ui-dictionary"); var d = new Dictionary<string, string>(); d.Add(collectionSettings.Language1Iso639Code, collectionSettings.Language1Name); if (!String.IsNullOrEmpty(collectionSettings.Language2Iso639Code)) SafelyAddLanguage(d, collectionSettings.Language2Iso639Code, collectionSettings.GetLanguage2Name(collectionSettings.Language2Iso639Code)); if (!String.IsNullOrEmpty(collectionSettings.Language3Iso639Code)) SafelyAddLanguage(d, collectionSettings.Language3Iso639Code, collectionSettings.GetLanguage3Name(collectionSettings.Language3Iso639Code)); SafelyAddLanguage(d, "vernacularLang", collectionSettings.Language1Iso639Code);//use for making the vernacular the first tab SafelyAddLanguage(d, "{V}", collectionSettings.Language1Name); SafelyAddLanguage(d, "{N1}", collectionSettings.GetLanguage2Name(collectionSettings.Language2Iso639Code)); SafelyAddLanguage(d, "{N2}", collectionSettings.GetLanguage3Name(collectionSettings.Language3Iso639Code)); // TODO: Eventually we need to look through all .bloom-translationGroup elements on the current page to determine // whether there is text in a language not yet added to the dictionary. // For now, we just add a few we know we need AddSomeCommonNationalLanguages(d); MakePageLabelLocalizable(pageDom, d); // Hard-coded localizations for 2.0 AddHtmlUiStrings(d); // Do this last, on the off-chance that the page contains a localizable string that matches // a language code. AddLanguagesUsedInPage(pageDom.RawDom, d); dictionaryScriptElement.InnerText = String.Format("function GetInlineDictionary() {{ return {0};}}", JsonConvert.SerializeObject(d)); // add i18n initialization script to the page //AddLocalizationTriggerToDom(pageDom); pageDom.Head.InsertAfter(dictionaryScriptElement, pageDom.Head.LastChild); _collectDynamicStrings = false; }
public CollectionSettingsDialog(CollectionSettings collectionSettings, XMatterPackFinder xmatterPackFinder, QueueRenameOfCollection queueRenameOfCollection) { _collectionSettings = collectionSettings; _xmatterPackFinder = xmatterPackFinder; _queueRenameOfCollection = queueRenameOfCollection; InitializeComponent(); if (_collectionSettings.IsSourceCollection) { _language1Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language1InSourceCollection", "Language 1", "In a vernacular collection, we say 'Vernacular Language', but in a souce collection, Vernacular has no relevance, so we use this different label"); _language2Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language2InSourceCollection", "Language 2", "In a vernacular collection, we say 'Language 2 (e.g. National Language)', but in a souce collection, National Language has no relevance, so we use this different label"); _language3Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language3InSourceCollection", "Language 3", "In a vernacular collection, we say 'Language 3 (e.g. Regional Language)', but in a souce collection, National Language has no relevance, so we use this different label"); } #if !DEBUG _showSendReceive.Enabled = false; #endif _showSendReceive.Checked = Settings.Default.ShowSendReceive; _showExperimentalTemplates.Checked = Settings.Default.ShowExperimentalBooks; _showExperimentCommands.Checked = Settings.Default.ShowExperimentalCommands; // _showSendReceive.CheckStateChanged += (sender, args) => // { // Settings.Default.ShowSendReceive = _showSendReceive.CheckState == // CheckState.Checked; // // _restartRequired = true; // UpdateDisplay(); // }; switch (Settings.Default.ImageHandler) { case "": _useImageServer.CheckState = CheckState.Checked; break; case "off": _useImageServer.CheckState = CheckState.Unchecked; break; case "http": _useImageServer.CheckState = CheckState.Checked; break; } // this._useImageServer.CheckedChanged += new System.EventHandler(this._useImageServer_CheckedChanged); _useImageServer.CheckStateChanged += new EventHandler(_useImageServer_CheckedChanged); UpdateDisplay(); }
private static void MakeCollection(string root, string language, string language1Iso639Code) { var spec = new NewCollectionSettings() { PathToSettingsFile = CollectionSettings.GetPathForNewSettings(root, language + " P1 Teacher's Guide"), AllowNewBooks = false, Country = "Uganda", DefaultLanguage1FontName = language, Language1Iso639Code = language1Iso639Code, IsSourceCollection = false, Language2Iso639Code = "en" }; var collectionSettings = new CollectionSettings(spec); collectionSettings.DefaultLanguage1FontName = "Calibri"; collectionSettings.Save(); var folio = MakeBook(collectionSettings, kpathToSHRPTemplates+"UgandaSHARP-P1GuideFolio"); //The Teacher's Guide has a set of vernacular labels that are inserted via custom style sheets. This copies //and renames the one for this language. File.Copy(kpathToSHRPTemplates+"UgandaSHARP-P1TeacherGuide/"+language+"Labels.css", Path.Combine(collectionSettings.FolderPath,"customCollectionStyles.css")); var themes = "Human body and health,Weather,Weather,Weather,Accidents and safety,Accidents and safety,Accidents and safety,Living together,Living together,Living together,Food and Nutrition,Food and Nutrition,Transport,Transport,Transport,Things we make,Things we make,Things we make,Our environment,Our environment,Our environment,Peace and security,Peace and security" .Split(new[] { ',' }); var themeNumbers = "4,5,5,5,6,6,6,7,7,7,8,8,9,9,9,10,10,10,11,11,11,12,12".Split(new[] { ',' }); var subThemes = "Personal hygiene,Elements and types of weather,Activities for different seasons,Effects and management of weather,Accidents and safety at home,Accidents and safety on the way,Accidents and safety at school,The family,Ways of living together in the school,Ways of living together in the community,Names and sources of food,Uses of food,Types and means of transport,Importance of transport,Measures related to transport,Things we make at home and school,Materials we use and their sources,Importance of things we make,Components and importance of things in our environment,Factors that damage our environment,Conservation of our environment,Peace and security in our home,Peace and security in our school".Split(new[] { ',' }); var subThemeNumbers = "2,1,2,3,1,2,3,1,2,3,1,2,1,2,3,1,2,3,1,2,3,1,2".Split(new[] { ',' }); var bookCount = 0; for (int term = 1; term < 4; term++) { var termIntro = MakeBook(collectionSettings, kpathToSHRPTemplates + "UgandaSHARP-P1TeacherGuideTermIntro"); termIntro.SetDataItem("term", term.ToString(), "en"); termIntro.Save(); for (int week = 2; week < 3 ; week++) { var weekBook = MakeBook(collectionSettings, kpathToSHRPTemplates+"UgandaSHARP-P1TeacherGuide"); weekBook.SetDataItem("term", term.ToString(), "*"); weekBook.SetDataItem("week", week.ToString(), "*"); SetThemeStuff(weekBook,themes[bookCount],themeNumbers[bookCount],subThemes[bookCount],subThemeNumbers[bookCount]); weekBook.Save(); ++bookCount; } } }
/// <summary> /// This is used when a book is first created from a source; without it, if the shell maker left the book as trilingual when working on it, /// then everytime someone created a new book based on it, it too would be trilingual. /// </summary> public static void SetInitialMultilingualSetting(BookData bookData, int oneTwoOrThreeContentLanguages, CollectionSettings collectionSettings) { //var multilingualClass = new string[]{"bloom-monolingual", "bloom-bilingual","bloom-trilingual"}[oneTwoOrThreeContentLanguages-1]; if (oneTwoOrThreeContentLanguages < 3) bookData.RemoveAllForms("contentLanguage3"); if (oneTwoOrThreeContentLanguages < 2) bookData.RemoveAllForms("contentLanguage2"); bookData.Set("contentLanguage1", collectionSettings.Language1Iso639Code, false); if (oneTwoOrThreeContentLanguages > 1) bookData.Set("contentLanguage2", collectionSettings.Language2Iso639Code, false); if (oneTwoOrThreeContentLanguages > 2 && !string.IsNullOrEmpty(collectionSettings.Language3Iso639Code)) bookData.Set("contentLanguage3", collectionSettings.Language3Iso639Code, false); }
public PublishModel(BookSelection bookSelection, PdfMaker pdfMaker, CurrentEditableCollectionSelection currentBookCollectionSelection, CollectionSettings collectionSettings, BookServer bookServer, BookThumbNailer thumbNailer, NavigationIsolator isolator) { BookSelection = bookSelection; _pdfMaker = pdfMaker; //_pdfMaker.EngineChoice = collectionSettings.PdfEngineChoice; _currentBookCollectionSelection = currentBookCollectionSelection; ShowCropMarks=false; _collectionSettings = collectionSettings; _bookServer = bookServer; _thumbNailer = thumbNailer; bookSelection.SelectionChanged += new EventHandler(OnBookSelectionChanged); _isoloator = isolator; //we don't want to default anymore: BookletPortion = BookletPortions.BookletPages; }
public Shell(Func<WorkspaceView> projectViewFactory, CollectionSettings collectionSettings, LibraryClosing libraryClosingEvent, QueueRenameOfCollection queueRenameOfCollection, Sparkle _sparkle) { queueRenameOfCollection.Subscribe(newName => _nameToChangeCollectionUponClosing = newName.Trim().SanitizeFilename('-')); _collectionSettings = collectionSettings; _libraryClosingEvent = libraryClosingEvent; InitializeComponent(); #if DEBUG WindowState = FormWindowState.Normal; //this.FormBorderStyle = FormBorderStyle.None; //fullscreen Size = new Size(1024,720); #endif _workspaceView = projectViewFactory(); _workspaceView.CloseCurrentProject += ((x, y) => { UserWantsToOpenADifferentProject = true; Close(); }); _sparkle.AboutToExitForInstallerRun += ((x, cancellable) => { cancellable.Cancel = false; QuitForVersionUpdate = true; Close(); }); _workspaceView.ReopenCurrentProject += ((x, y) => { UserWantsToOpeReopenProject = true; Close(); }); SystemEvents.SessionEnding += ((x,y)=> { QuitForSystemShutdown=true; Close(); }); _workspaceView.BackColor = System.Drawing.Color.FromArgb(64,64,64); _workspaceView.Dock = System.Windows.Forms.DockStyle.Fill; this.Controls.Add(this._workspaceView); SetWindowText(); }
public CollectionSettingsDialog(CollectionSettings collectionSettings, XMatterPackFinder xmatterPackFinder, QueueRenameOfCollection queueRenameOfCollection) { _collectionSettings = collectionSettings; _xmatterPackFinder = xmatterPackFinder; _queueRenameOfCollection = queueRenameOfCollection; InitializeComponent(); if(_collectionSettings.IsSourceCollection) { _language1Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language1InSourceCollection", "Language 1", "In a vernacular collection, we say 'Vernacular Language', but in a souce collection, Vernacular has no relevance, so we use this different label"); _language2Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language2InSourceCollection", "Language 2", "In a vernacular collection, we say 'Language 2 (e.g. National Language)', but in a souce collection, National Language has no relevance, so we use this different label"); _language3Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language3InSourceCollection", "Language 3", "In a vernacular collection, we say 'Language 3 (e.g. Regional Language)', but in a souce collection, National Language has no relevance, so we use this different label"); } #if !DEBUG _showSendReceive.Enabled = false; #endif _showSendReceive.Checked = Settings.Default.ShowSendReceive; _showExperimentalTemplates.Checked = Settings.Default.ShowExperimentalBooks; _showExperimentCommands.Checked = Settings.Default.ShowExperimentalCommands; // _showSendReceive.CheckStateChanged += (sender, args) => // { // Settings.Default.ShowSendReceive = _showSendReceive.CheckState == // CheckState.Checked; // // _restartRequired = true; // UpdateDisplay(); // }; switch(Settings.Default.ImageHandler) { case "": _useImageServer.CheckState = CheckState.Checked; break; case "off": _useImageServer.CheckState = CheckState.Unchecked; break; case "http": _useImageServer.CheckState = CheckState.Checked; break; } // this._useImageServer.CheckedChanged += new System.EventHandler(this._useImageServer_CheckedChanged); _useImageServer.CheckStateChanged += new EventHandler(_useImageServer_CheckedChanged); UpdateDisplay(); }
//review: is this even used, since we override GetSearchPaths()? public BloomFileLocator(CollectionSettings collectionSettings, XMatterPackFinder xMatterPackFinder, IEnumerable<string> factorySearchPaths, IEnumerable<string> userInstalledSearchPaths, IEnumerable<string> afterXMatterSearchPaths = null) : base(factorySearchPaths.Concat( userInstalledSearchPaths)) { if (afterXMatterSearchPaths == null) { afterXMatterSearchPaths = new string[] {}; } _bookSpecificSearchPaths = new List<string>(); _collectionSettings = collectionSettings; _xMatterPackFinder = xMatterPackFinder; _factorySearchPaths = factorySearchPaths; _userInstalledSearchPaths = userInstalledSearchPaths; _afterXMatterSearchPaths = afterXMatterSearchPaths; sTheMostRecentBloomFileLocator = this; }
public void Setup() { _collectionSettings = new CollectionSettings(new NewCollectionSettings() { PathToSettingsFile = CollectionSettings.GetPathForNewSettings(new TemporaryFolder("BookDataTests").Path, "test"), Language1Iso639Code = "xyz", Language2Iso639Code = "en", Language3Iso639Code = "fr" }); ErrorReport.IsOkToInteractWithUser = false; var localizationDirectory = FileLocator.GetDirectoryDistributedWithApplication("localization"); _localizationManager = LocalizationManager.Create("fr", "Bloom", "Bloom", "1.0.0", localizationDirectory, "SIL/Bloom", null, "", new string[] {}); _palasoLocalizationManager = LocalizationManager.Create("fr", "Palaso","Palaso", "1.0.0", localizationDirectory, "SIL/Bloom", null, "", new string[] { }); _brandingFolder = new TemporaryFolder("unitTestBrandingFolder"); _pathToBrandingSettingJson = _brandingFolder.Combine("settings.json"); }
public Book(BookInfo info, IBookStorage storage, ITemplateFinder templateFinder, CollectionSettings collectionSettings, HtmlThumbNailer thumbnailProvider, PageSelection pageSelection, PageListChangedEvent pageListChangedEvent, BookRefreshEvent bookRefreshEvent) { BookInfo = info; Guard.AgainstNull(storage,"storage"); // This allows the _storage to storage.MetaData = info; _storage = storage; //this is a hack to keep these two in sync (in one direction) _storage.FolderPathChanged +=(x,y)=>BookInfo.FolderPath = _storage.FolderPath; _templateFinder = templateFinder; _collectionSettings = collectionSettings; _thumbnailProvider = thumbnailProvider; _pageSelection = pageSelection; _pageListChangedEvent = pageListChangedEvent; _bookRefreshEvent = bookRefreshEvent; _bookData = new BookData(OurHtmlDom, _collectionSettings, UpdateImageMetadataAttributes); if (IsEditable && !HasFatalError) { _bookData.SynchronizeDataItemsThroughoutDOM(); WriteLanguageDisplayStyleSheet(); //NB: if you try to do this on a file that's in program files, access will be denied OurHtmlDom.AddStyleSheet(@"languageDisplay.css"); } FixBookIdAndLineageIfNeeded(); _storage.Dom.RemoveExtraContentTypesMetas(); Guard.Against(OurHtmlDom.RawDom.InnerXml=="","Bloom could not parse the xhtml of this document"); }
public LibraryModel(string pathToLibrary, CollectionSettings collectionSettings, SendReceiver sendReceiver, BookSelection bookSelection, SourceCollectionsList sourceCollectionsList, BookCollection.Factory bookCollectionFactory, EditBookCommand editBookCommand, CreateFromSourceBookCommand createFromSourceBookCommand, BookServer bookServer, CurrentEditableCollectionSelection currentEditableCollectionSelection) { _bookSelection = bookSelection; _pathToLibrary = pathToLibrary; _collectionSettings = collectionSettings; _sendReceiver = sendReceiver; _sourceCollectionsList = sourceCollectionsList; _bookCollectionFactory = bookCollectionFactory; _editBookCommand = editBookCommand; _bookServer = bookServer; _currentEditableCollectionSelection = currentEditableCollectionSelection; createFromSourceBookCommand.Subscribe(CreateFromSourceBook); }
/// <summary> /// stick in a json with various settings we want to make available to the javascript /// </summary> public static void AddUISettingsToDom(HtmlDom pageDom, CollectionSettings collectionSettings, IFileLocator fileLocator) { XmlElement element = pageDom.RawDom.SelectSingleNode("//script[@id='ui-settings']") as XmlElement; if (element != null) element.ParentNode.RemoveChild(element); element = pageDom.RawDom.CreateElement("script"); element.SetAttribute("type", "text/javascript"); element.SetAttribute("id", "ui-settings"); var d = new Dictionary<string, string>(); //d.Add("urlOfUIFiles", "file:///" + fileLocator.LocateDirectory("ui", "ui files directory")); if (!String.IsNullOrEmpty(Settings.Default.LastSourceLanguageViewed)) { d.Add("defaultSourceLanguage", Settings.Default.LastSourceLanguageViewed); } d.Add("languageForNewTextBoxes", collectionSettings.Language1Iso639Code); d.Add("bloomBrowserUIFolder", FileLocator.GetDirectoryDistributedWithApplication("BloomBrowserUI")); var topics = new[] { "Agriculture", "Animal Stories", "Business", "Culture", "Community Living", "Dictionary", "Environment", "Fiction", "Health", "How To", "Math", "Non Fiction", "Spiritual", "Personal Development", "Primer", "Science", "Traditional Story" }; var builder = new StringBuilder(); builder.Append("["); foreach (var topic in topics) { var localized = LocalizationManager.GetDynamicString("Bloom", "Topics." + topic, topic, "shows in the topics chooser in the edit tab"); builder.Append("\""+localized+"\", "); } builder.Append("]"); d.Add("topics", builder.ToString().Replace(", ]","]")); // d.Add("topics", "['Agriculture', 'Animal Stories', 'Business', 'Culture', 'Community Living', 'Dictionary', 'Environment', 'Fiction', 'Health', 'How To', 'Math', 'Non Fiction', 'Spiritual', 'Personal Development', 'Primer', 'Science', 'Tradition']".Replace("'", "\\\"")); element.InnerText = String.Format("function GetSettings() {{ return {0};}}", JsonConvert.SerializeObject(d)); var head = pageDom.RawDom.SelectSingleNode("//head"); head.InsertAfter(element, head.LastChild); }
public CollectionSettingsDialog(CollectionSettings collectionSettings, QueueRenameOfCollection queueRenameOfCollection, PageRefreshEvent pageRefreshEvent, TeamCollectionManager tcManager, XMatterPackFinder xmatterPackFinder) { _collectionSettings = collectionSettings; _queueRenameOfCollection = queueRenameOfCollection; _pageRefreshEvent = pageRefreshEvent; _xmatterPackFinder = xmatterPackFinder; InitializeComponent(); _language1Name.UseMnemonic = false; // Allow & to be part of the language display names. _language2Name.UseMnemonic = false; // This may be unlikely, but can't be ruled out. _language3Name.UseMnemonic = false; // See https://issues.bloomlibrary.org/youtrack/issue/BL-9919. PendingFontSelections[0] = _collectionSettings.LanguagesZeroBased[0].FontName; PendingFontSelections[1] = _collectionSettings.LanguagesZeroBased[1].FontName; var have3rdLanguage = _collectionSettings.LanguagesZeroBased[2] != null; PendingFontSelections[2] = have3rdLanguage ? _collectionSettings.LanguagesZeroBased[2].FontName : ""; PendingNumberingStyle = _collectionSettings.PageNumberStyle; PendingXmatter = _collectionSettings.XMatterPackName; CollectionSettingsApi.DialogBeingEdited = this; if (_collectionSettings.IsSourceCollection) { _language1Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language1InSourceCollection", "Language 1", "In a local language collection, we say 'Local Language', but in a source collection, Local Language has no relevance, so we use this different label"); _language2Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language2InSourceCollection", "Language 2", "In a local language collection, we say 'Language 2 (e.g. National Language)', but in a source collection, National Language has no relevance, so we use this different label"); _language3Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language3InSourceCollection", "Language 3", "In a local language collection, we say 'Language 3 (e.g. Regional Language)', but in a source collection, National Language has no relevance, so we use this different label"); } _showExperimentalBookSources.Checked = ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kExperimentalSourceBooks); _allowTeamCollection.Checked = ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kTeamCollections); _allowSpreadsheetImportExport.Checked = ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kSpreadsheetImportExport); if (!ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kTeamCollections) && tcManager.CurrentCollectionEvenIfDisconnected == null) { this._tab.Controls.Remove(this._teamCollectionTab); } // Don't allow the user to disable the Team Collection feature if we're currently in a Team Collection. _allowTeamCollection.Enabled = !(_allowTeamCollection.Checked && tcManager.CurrentCollectionEvenIfDisconnected != null); // AutoUpdate applies only to Windows: see https://silbloom.myjetbrains.com/youtrack/issue/BL-2317. if (SIL.PlatformUtilities.Platform.IsWindows) { _automaticallyUpdate.Checked = Settings.Default.AutoUpdate; } else { _automaticallyUpdate.Hide(); } // Without this, PendingDefaultBookshelf stays null unless the user changes it. // The result is the bookshelf selection gets cleared when other collection settings are saved. See BL-10093. PendingDefaultBookshelf = _collectionSettings.DefaultBookshelf; CollectionSettingsApi.BrandingChangeHandler = ChangeBranding; TeamCollectionApi.TheOneInstance.SetCallbackToReopenCollection(() => { _restartRequired = true; ReactDialog.CloseCurrentModal(); // close the top Create dialog _okButton_Click(null, null); // close this dialog }); UpdateDisplay(); if (CollectionSettingsApi.FixEnterpriseSubscriptionCodeMode) { _tab.SelectedTab = _enterpriseTab; } if (tcManager.CurrentCollectionEvenIfDisconnected == null) { _noRenameTeamCollectionLabel.Visible = false; } else { _bloomCollectionName.Enabled = false; } }
public CollectionSettingsDialog(CollectionSettings collectionSettings, XMatterPackFinder xmatterPackFinder, QueueRenameOfCollection queueRenameOfCollection, PageRefreshEvent pageRefreshEvent, TeamCollectionManager tcManager) { _collectionSettings = collectionSettings; _xmatterPackFinder = xmatterPackFinder; _queueRenameOfCollection = queueRenameOfCollection; _pageRefreshEvent = pageRefreshEvent; InitializeComponent(); // moved from the Designer where it was deleted if the Designer was touched _xmatterList.Columns.AddRange(new[] { new ColumnHeader() { Width = 250 } }); _language1Name.UseMnemonic = false; // Allow & to be part of the language display names. _language2Name.UseMnemonic = false; // This may be unlikely, but can't be ruled out. _language3Name.UseMnemonic = false; // See https://issues.bloomlibrary.org/youtrack/issue/BL-9919. _language1FontLabel.UseMnemonic = false; _language2FontLabel.UseMnemonic = false; _language3FontLabel.UseMnemonic = false; CollectionSettingsApi.DialogBeingEdited = this; if (_collectionSettings.IsSourceCollection) { _language1Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language1InSourceCollection", "Language 1", "In a local language collection, we say 'Local Language', but in a source collection, Local Language has no relevance, so we use this different label"); _language2Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language2InSourceCollection", "Language 2", "In a local language collection, we say 'Language 2 (e.g. National Language)', but in a source collection, National Language has no relevance, so we use this different label"); _language3Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language3InSourceCollection", "Language 3", "In a local language collection, we say 'Language 3 (e.g. Regional Language)', but in a source collection, National Language has no relevance, so we use this different label"); } _showExperimentalBookSources.Checked = ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kExperimentalSourceBooks); _allowTeamCollection.Checked = ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kTeamCollections); if (!ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kTeamCollections) && tcManager.CurrentCollectionEvenIfDisconnected == null) { this._tab.Controls.Remove(this._teamCollectionTab); } // Don't allow the user to disable the Team Collection feature if we're currently in a Team Collection. _allowTeamCollection.Enabled = !(_allowTeamCollection.Checked && tcManager.CurrentCollectionEvenIfDisconnected != null); // AutoUpdate applies only to Windows: see https://silbloom.myjetbrains.com/youtrack/issue/BL-2317. if (SIL.PlatformUtilities.Platform.IsWindows) { _automaticallyUpdate.Checked = Settings.Default.AutoUpdate; } else { _automaticallyUpdate.Hide(); } // Without this, PendingDefaultBookshelf stays null unless the user changes it. // The result is the bookshelf selection gets cleared when other collection settings are saved. See BL-10093. PendingDefaultBookshelf = _collectionSettings.DefaultBookshelf; // _showSendReceive.CheckStateChanged += (sender, args) => // { // Settings.Default.ShowSendReceive = _showSendReceive.CheckState == // CheckState.Checked; // // _restartRequired = true; // UpdateDisplay(); // }; CollectionSettingsApi.BrandingChangeHandler = ChangeBranding; SetupEnterpriseBrowser(); TeamCollectionApi.TheOneInstance.SetCallbackToReopenCollection(() => { _restartRequired = true; ReactDialog.CloseCurrentModal(); // close the top Create dialog _okButton_Click(null, null); // close this dialog }); UpdateDisplay(); if (CollectionSettingsApi.FixEnterpriseSubscriptionCodeMode) { _tab.SelectedTab = _enterpriseTab; } if (tcManager.CurrentCollectionEvenIfDisconnected == null) { _noRenameTeamCollectionLabel.Visible = false; } else { _bloomCollectionName.Enabled = false; } // This code would mostly more naturally go in Designer. Unfortunately we can't run designer // until we get back in a state where all our dependencies are sufficiently consistent. _defaultBookshelfControl = ReactControl.Create("defaultBookshelfControlBundle"); tabPage2.Controls.Add(_defaultBookshelfControl); _defaultBookshelfControl.Location = new Point(_xmatterDescription.Left, _xmatterDescription.Bottom + 30); // We'd like it to be as big as possible, not just big enough for the immediate content. // Until React takes over at least the whole tab, the pull-down part of the combo can't // stretch outside the Gecko control. _defaultBookshelfControl.Size = new Size(_xmatterList.Width, 200); }