public void UpdateDisplay()
{
try
{
_updatingDisplay = true;
_contentLanguagesDropdown.DropDownItems.Clear();
foreach (var l in _model.ContentLanguages)
{
ToolStripMenuItem item = (ToolStripMenuItem)_contentLanguagesDropdown.DropDownItems.Add(l.ToString());
item.Tag = l;
item.Enabled = !l.Locked;
item.Checked = l.Selected;
item.CheckOnClick = true;
item.CheckedChanged += new EventHandler(OnContentLanguageDropdownItem_CheckedChanged);
}
_layoutChoices.DropDownItems.Clear();
var layout = _model.GetCurrentLayout();
var layoutChoices = _model.GetLayoutChoices();
foreach (var l in layoutChoices)
{
var text = LocalizationManager.GetDynamicString("Bloom", "LayoutChoices." + l.ToString(), l.ToString());
ToolStripMenuItem item = (ToolStripMenuItem)_layoutChoices.DropDownItems.Add(text);
item.Tag = l;
//we don't allow the split options here
if (l.ElementDistribution == Book.Layout.ElementDistributionChoices.SplitAcrossPages)
{
item.Enabled = false;
item.ToolTipText = LocalizationManager.GetString("EditTab.layoutInPublishTabOnlyNotice", "This option is only available in the Publish tab.");
}
item.Text = text;
item.Click += new EventHandler(OnPaperSizeAndOrientationMenuClick);
}
if (layoutChoices.Count() < 2)
{
ToolStripMenuItem item = (ToolStripMenuItem)_layoutChoices.DropDownItems.Add(LocalizationManager.GetString("EditTab.noOtherLayouts", "There are no other layout options for this template.", "Show in the layout chooser dropdown of the edit tab, if there was only a single layout choice"));
item.Tag = null;
item.Enabled = false;
}
_layoutChoices.Text = LocalizationManager.GetDynamicString("Bloom", "LayoutChoices." + layout, layout.ToString());
switch (_model.NumberOfDisplayedLanguages)
{
case 1:
_contentLanguagesDropdown.Text = LocalizationManager.GetString("EditTab.monolingual", "One Language", "Shown in edit tab multilingualism chooser, for monolingual mode, one language per page");
break;
case 2:
_contentLanguagesDropdown.Text = LocalizationManager.GetString("EditTab.bilingual", "Two Languages", "Shown in edit tab multilingualism chooser, for bilingual mode, 2 languages per page");
break;
case 3:
_contentLanguagesDropdown.Text = LocalizationManager.GetString("EditTab.trilingual", "Three Languages", "Shown in edit tab multilingualism chooser, for trilingual mode, 3 languages per page");
break;
}
//I'm surprised that L10NSharp (in aug 2014) doesn't automatically make tooltips localizable, but this is how I got it to work
_layoutChoices.ToolTipText = LocalizationManager.GetString("EditTab.PageSizeAndOrientation.Tooltip",
//_layoutChoices.ToolTipText); doesn't work because the scanner needs literals
"Choose a page size and orientation");
}
catch (Exception error)
{
Palaso.Reporting.ErrorReport.NotifyUserOfProblem(error, "There was a problem updating the edit display.");
}
finally
{
_updatingDisplay = false;
}
}