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)
{
_collectionSettings.PageNumberStyle = CollectionSettings.PageNumberStyleKeys[_numberStyleCombo.SelectedIndex]; // this must be the non-localized version
}
if (_brandingCombo.SelectedItem != null)
{
_collectionSettings.BrandingProjectName = _brandingCombo.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.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;
}