private void _okButton_Click(object sender, EventArgs e) { Logger.WriteMinorEvent("Settings Dialog OK Clicked"); _collectionSettings.XMatterPackName = ((XMatterInfo)_xmatterPackCombo.SelectedItem).Key; _collectionSettings.Country = _countryText.Text.Trim(); _collectionSettings.Province = _provinceText.Text.Trim(); _collectionSettings.District = _districtText.Text.Trim(); _collectionSettings.DefaultLanguage1FontName = _fontCombo.SelectedItem.ToString(); //no point in letting them have the Nat lang 2 be the same as 1 if (_collectionSettings.Language2Iso639Code == _collectionSettings.Language3Iso639Code) { _collectionSettings.Language3Iso639Code = null; } if (_bloomCollectionName.Text.Trim() != _collectionSettings.CollectionName) { _queueRenameOfCollection.Raise(_bloomCollectionName.Text.SanitizeFilename('-')); //_collectionSettings.AttemptSaveAsToNewName(_bloomCollectionName.Text.SanitizeFilename('-')); } _collectionSettings.Save(); Logger.WriteEvent("Closing Settings Dialog"); Close(); DialogResult = _restartRequired ? DialogResult.Yes : DialogResult.OK; }
private void _okButton_Click(object sender, EventArgs e) { Logger.WriteMinorEvent("Settings Dialog OK Clicked"); _collectionSettings.Country = _countryText.Text.Trim(); _collectionSettings.Province = _provinceText.Text.Trim(); _collectionSettings.District = _districtText.Text.Trim(); if (_fontComboLanguage1.SelectedItem != null) { _collectionSettings.DefaultLanguage1FontName = _fontComboLanguage1.SelectedItem.ToString(); } if (_fontComboLanguage2.SelectedItem != null) { _collectionSettings.DefaultLanguage2FontName = _fontComboLanguage2.SelectedItem.ToString(); } if (_fontComboLanguage3.SelectedItem != null) { _collectionSettings.DefaultLanguage3FontName = _fontComboLanguage3.SelectedItem.ToString(); } if (_numberStyleCombo.SelectedItem != null) { // have to do this lookup because we need the non-localized version of the name, and // we can't get at the original dictionary by index var styleName = _styleNames[_numberStyleCombo.SelectedIndex]; _collectionSettings.PageNumberStyle = styleName; } if (_brandingCombo.SelectedItem != null) { var brand = _brandingCombo.SelectedItem as BrandingProject; _collectionSettings.BrandingProjectKey = brand?.Key; } //no point in letting them have the Nat lang 2 be the same as 1 if (_collectionSettings.Language2Iso639Code == _collectionSettings.Language3Iso639Code) { _collectionSettings.Language3Iso639Code = null; } if (_bloomCollectionName.Text.Trim() != _collectionSettings.CollectionName) { _queueRenameOfCollection.Raise(_bloomCollectionName.Text.SanitizeFilename('-')); //_collectionSettings.PrepareToRenameCollection(_bloomCollectionName.Text.SanitizeFilename('-')); } Logger.WriteEvent("Closing Settings Dialog"); if (_xmatterList.SelectedItems.Count > 0 && ((XMatterInfo)_xmatterList.SelectedItems[0].Tag).Key != _collectionSettings.XMatterPackName) { _collectionSettings.XMatterPackName = ((XMatterInfo)_xmatterList.SelectedItems[0].Tag).Key; _restartRequired = true; // now that we've made them match, we won't detect by the normal means, so set this hard flag } _collectionSettings.Save(); Close(); if (!AnyReasonToRestart()) { _pageRefreshEvent.Raise(PageRefreshEvent.SaveBehavior.SaveBeforeRefresh); } DialogResult = AnyReasonToRestart() ? DialogResult.Yes : DialogResult.OK; }
private void _okButton_Click(object sender, EventArgs e) { Logger.WriteMinorEvent("Settings Dialog OK Clicked"); CollectionSettingsApi.DialogBeingEdited = null; _collectionSettings.Country = _countryText.Text.Trim(); _collectionSettings.Province = _provinceText.Text.Trim(); _collectionSettings.District = _districtText.Text.Trim(); var languages = _collectionSettings.LanguagesZeroBased; for (int i = 0; i < 3; i++) { if (languages[i] == null) { continue; } languages[i].FontName = PendingFontSelections[i]; } _collectionSettings.PageNumberStyle = PendingNumberingStyle; // non-localized key _collectionSettings.BrandingProjectKey = _brand; _collectionSettings.SubscriptionCode = _subscriptionCode; string xmatterKeyForcedByBranding = _collectionSettings.GetXMatterPackNameSpecifiedByBrandingOrNull(); PendingXmatter = this._xmatterPackFinder.GetValidXmatter(xmatterKeyForcedByBranding, PendingXmatter); _collectionSettings.XMatterPackName = PendingXmatter; //no point in letting them have the Nat lang 2 be the same as 1 if (_collectionSettings.Language2Iso639Code == _collectionSettings.Language3Iso639Code) { _collectionSettings.Language3Iso639Code = null; } if (_bloomCollectionName.Text.Trim() != _collectionSettings.CollectionName) { _queueRenameOfCollection.Raise(_bloomCollectionName.Text.SanitizeFilename('-')); //_collectionSettings.PrepareToRenameCollection(_bloomCollectionName.Text.SanitizeFilename('-')); } Logger.WriteEvent("Closing Settings Dialog"); _collectionSettings.DefaultBookshelf = PendingDefaultBookshelf; _collectionSettings.Save(); Close(); DialogResult = AnyReasonToRestart() ? DialogResult.Yes : DialogResult.OK; }
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; } } }