コード例 #1
0
        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;
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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;
        }