Inheritance: CollectionSettings
Beispiel #1
0
        public CollectionSettings(NewCollectionSettings collectionInfo)
            : this(collectionInfo.PathToSettingsFile)
        {
            AllowNewBooks      = collectionInfo.AllowNewBooks;
            Language1.FontName = collectionInfo.Language1.FontName;
            Language1          = collectionInfo.Language1;
            Language2          = collectionInfo.Language2;
            Language3          = collectionInfo.Language3;

            Language2.FontName = Language3.FontName = WritingSystem.GetDefaultFontName();


            Country            = collectionInfo.Country;
            Province           = collectionInfo.Province;
            District           = collectionInfo.District;
            IsSourceCollection = collectionInfo.IsSourceCollection;
            XMatterPackName    = collectionInfo.XMatterPackName;
            PageNumberStyle    = collectionInfo.PageNumberStyle;
            BrandingProjectKey = collectionInfo.BrandingProjectKey;
            SubscriptionCode   = collectionInfo.SubscriptionCode;
            if (BrandingProjectKey == "Local Community")
            {
                // migrate for 4.4
                BrandingProjectKey = "Local-Community";
            }

            AudioRecordingMode = collectionInfo.AudioRecordingMode;
            AudioRecordingTrimEndMilliseconds = collectionInfo.AudioRecordingTrimEndMilliseconds;

            Save();
        }
        public NewCollectionWizard(bool showWelcome)
        {
            InitializeComponent();

            if (ReallyDesignMode)
                return;

            _collectionInfo = new NewCollectionSettings();
            _kindOfCollectionPage.Tag = kindOfCollectionControl1;
            kindOfCollectionControl1.Init(SetNextButtonState, _collectionInfo);

            _languageLocationPage.Tag = _languageLocationControl;
            _languageLocationControl.Init(_collectionInfo);

            _collectionNamePage.Tag = _collectionNameControl;
            _collectionNameControl.Init(SetNextButtonState, _collectionInfo, DefaultParentDirectoryForCollections);

            _vernacularLanguagePage.Tag = _vernacularLanguageIdControl;
            _vernacularLanguageIdControl.Init(SetNextButtonState, _collectionInfo);

            _welcomePage.Suppress = !showWelcome;

            //The L10NSharpExtender and this wizard don't get along (they conspire to crash Visual Studio with a stack overflow)
            //so we do all of this by hand
            var chooser = new Button();// new L10NSharp.UI.UILanguageComboBox() { ShowOnlyLanguagesHavingLocalizations = false };
            chooser.Location = new Point(100,100);
            chooser.Size= new Size(50,50);
            chooser.Visible = true;
            chooser.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            //chooser.SelectedValueChanged += new EventHandler(chooser_SelectedValueChanged);
            wizardControl1.Controls.Add(chooser);

            SetLocalizedStrings();
        }
Beispiel #3
0
        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;
                }
            }
        }
        public CollectionSettings(NewCollectionSettings collectionInfo)
            : this(collectionInfo.PathToSettingsFile)
        {
            AllowNewBooks = collectionInfo.AllowNewBooks;
            DefaultLanguage1FontName = GetDefaultFontName();

            Language1Iso639Code = collectionInfo.Language1Iso639Code;
            Language2Iso639Code = collectionInfo.Language2Iso639Code;
            Language3Iso639Code = collectionInfo.Language3Iso639Code;
            Language1Name = collectionInfo.Language1Name;
            Country = collectionInfo.Country;
            Province = collectionInfo.Province;
            District = collectionInfo.District;
            IsSourceCollection = collectionInfo.IsSourceCollection;
            XMatterPackName = collectionInfo.XMatterPackName;
            Save();
        }
Beispiel #5
0
        public CollectionSettings(NewCollectionSettings collectionInfo)
            : this(collectionInfo.PathToSettingsFile)
        {
            AllowNewBooks            = collectionInfo.AllowNewBooks;
            DefaultLanguage1FontName = DefaultLanguage2FontName = DefaultLanguage3FontName = GetDefaultFontName();

            Language1Iso639Code = collectionInfo.Language1Iso639Code;
            Language2Iso639Code = collectionInfo.Language2Iso639Code;
            Language3Iso639Code = collectionInfo.Language3Iso639Code;
            Language1Name       = collectionInfo.Language1Name;
            Country             = collectionInfo.Country;
            Province            = collectionInfo.Province;
            District            = collectionInfo.District;
            IsSourceCollection  = collectionInfo.IsSourceCollection;
            XMatterPackName     = collectionInfo.XMatterPackName;
            Save();
        }
Beispiel #6
0
        public CollectionSettings(NewCollectionSettings collectionInfo)
            : this(collectionInfo.PathToSettingsFile)
        {
            AllowNewBooks            = collectionInfo.AllowNewBooks;
            DefaultLanguage1FontName = collectionInfo.DefaultLanguage1FontName;
            Language1LineHeight      = collectionInfo.Language1LineHeight;
            IsLanguage1Rtl           = collectionInfo.IsLanguage1Rtl;
            DefaultLanguage2FontName = DefaultLanguage3FontName = GetDefaultFontName();

            Language1Iso639Code = collectionInfo.Language1Iso639Code;
            Language2Iso639Code = collectionInfo.Language2Iso639Code;
            Language3Iso639Code = collectionInfo.Language3Iso639Code;
            Language1Name       = collectionInfo.Language1Name;
            Country             = collectionInfo.Country;
            Province            = collectionInfo.Province;
            District            = collectionInfo.District;
            IsSourceCollection  = collectionInfo.IsSourceCollection;
            XMatterPackName     = collectionInfo.XMatterPackName;
            PageNumberStyle     = collectionInfo.PageNumberStyle;
            BrandingProjectKey  = collectionInfo.BrandingProjectKey;

            Save();
        }
        public CollectionSettings(NewCollectionSettings collectionInfo)
            : this(collectionInfo.PathToSettingsFile)
        {
            AllowNewBooks = collectionInfo.AllowNewBooks;
            DefaultLanguage1FontName = collectionInfo.DefaultLanguage1FontName;
            Language1LineHeight = collectionInfo.Language1LineHeight;
            IsLanguage1Rtl = collectionInfo.IsLanguage1Rtl;
            DefaultLanguage2FontName = DefaultLanguage3FontName = GetDefaultFontName();

            Language1Iso639Code = collectionInfo.Language1Iso639Code;
            Language2Iso639Code = collectionInfo.Language2Iso639Code;
            Language3Iso639Code = collectionInfo.Language3Iso639Code;
            Language1Name = collectionInfo.Language1Name;
            Country = collectionInfo.Country;
            Province = collectionInfo.Province;
            District = collectionInfo.District;
            IsSourceCollection = collectionInfo.IsSourceCollection;
            XMatterPackName = collectionInfo.XMatterPackName;
            PageNumberStyle = collectionInfo.PageNumberStyle;
            BrandingProjectName = collectionInfo.BrandingProjectName;

            Save();
        }
 public static void EnsureDownloadFolderExists()
 {
     // We need the download folder to exist if we are asked to download a book.
     // We also want it to exist, to show the (planned) link that offers to launch the web site.
     // Another advantage of creating it early is that we don't have to create it in the UI when we want to add
     // a downloaded book to the UI.
     // So, we just make sure it exists here at startup.
     string downloadFolder = BookTransfer.DownloadFolder;
     if (!Directory.Exists(downloadFolder))
     {
         var pathToSettingsFile = CollectionSettings.GetPathForNewSettings(Path.GetDirectoryName(downloadFolder),
             Path.GetFileName(downloadFolder));
         var settings = new NewCollectionSettings()
         {
             Language1Iso639Code = "en",
             Language1Name = "English",
             IsSourceCollection = true,
             PathToSettingsFile = pathToSettingsFile
             // All other defaults are fine
         };
         CollectionSettings.CreateNewCollection(settings);
     }
 }
 public static void CreateNewCollection(NewCollectionSettings collectionInfo)
 {
     // For some reason this constructor is used to create new collections. But I think a static method is much clearer.
     new CollectionSettings(collectionInfo);
 }
 public void Init(NewCollectionSettings collectionInfo)
 {
     _collectionInfo = collectionInfo;
 }
 public void Init(Action<UserControl, bool> SetButtonState, NewCollectionSettings collectionInfo, string destinationDirectory)
 {
     _setNextButtonState = SetButtonState;
     _collectionInfo = collectionInfo;
     _destinationDirectory = destinationDirectory;
 }
 private void OnCancel(object sender, EventArgs e)
 {
     DialogResult = DialogResult.Cancel;
     _collectionInfo = null;
     Close();
 }
 public static void CreateNewCollection(NewCollectionSettings collectionInfo)
 {
     // For some reason this constructor is used to create new collections. But I think a static method is much clearer.
     new CollectionSettings(collectionInfo);
 }