private bool MigrateSettingsToAndikaNewBasicFont()
{
const string newFont = "Andika New Basic";
if (GetDefaultFontName() != newFont) // sanity check to make sure Andika New Basic is installed
return false;
const string id = "CollectionSettingsDialog.AndikaNewBasicUpdate";
var basicMessage = LocalizationManager.GetDynamicString("Bloom", id + "1",
"Bloom is switching the default font for \"{0}\" to the new \"Andika New Basic\".");
var secondaryMessage = LocalizationManager.GetDynamicString("Bloom", id + "2",
"This will improve the printed output for most languages. If your language is one of the few that need \"Andika\", you can switch it back in Settings:Book Making.");
const string oldFont = "Andika";
var safeLanguages = new[] {"en", "es", "fr", "id", "tpi"};
string msg = string.Empty;
if(DefaultLanguage1FontName == oldFont)
{
DefaultLanguage1FontName = newFont;
if (!safeLanguages.Contains(Language1Iso639Code))
{
msg += String.Format(basicMessage, Language1Name) + Environment.NewLine;
}
}
if (DefaultLanguage2FontName == oldFont)
{
DefaultLanguage2FontName = newFont;
if (!String.IsNullOrEmpty(Language2Iso639Code) && !safeLanguages.Contains(Language2Iso639Code))
{
msg += String.Format(basicMessage, GetLanguage2Name(Language2Iso639Code)) + Environment.NewLine;
}
}
if (DefaultLanguage3FontName == oldFont)
{
DefaultLanguage3FontName = newFont;
if (!String.IsNullOrEmpty(Language3Iso639Code) && !safeLanguages.Contains(Language3Iso639Code))
{
msg += String.Format(basicMessage, GetLanguage3Name(Language3Iso639Code)) + Environment.NewLine;
}
}
// Only notify the user if the change involves a language that is not known to be okay with
// the new font.
if (!String.IsNullOrEmpty(msg) && ErrorReport.IsOkToInteractWithUser)
{
msg += Environment.NewLine + secondaryMessage;
// NB: this MessageBoxOptions.DefaultDesktopOnly option is more than the name implies. It changes the message to a "service message" which is the only
// way I've found to get the box into the taskbar.
MessageBox.Show(msg, "Bloom", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
}
return true;
}