Bloom.Edit.EditingView.UpdateDisplay C# (CSharp) Method

UpdateDisplay() public method

public UpdateDisplay ( ) : void
return void
        public void UpdateDisplay()
        {
            try
            {
                _updatingDisplay = true;

                _contentLanguagesDropdown.DropDownItems.Clear();
                // L10NSharp doesn't do this automatically
                _contentLanguagesDropdown.ToolTipText = LocalizationManager.GetString("EditTab.ContentLanguagesDropdown.ToolTip",
                    //_contentLanguagesDropdown.ToolTipText); doesn't work because the scanner needs literals
                    "Choose language to make this a bilingual or trilingual book");

                foreach(var l in _model.ContentLanguages)
                {
                    var item = AddDropdownItemSafely(_contentLanguagesDropdown, 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());
                    var item = AddDropdownItemSafely(_layoutChoices, 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)
                {
                    var text = 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");
                    var item = AddDropdownItemSafely(_layoutChoices, text);
                    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");

                _pageListView.UpdateDisplay();
            }
            catch(Exception error)
            {
                SIL.Reporting.ErrorReport.NotifyUserOfProblem(error, "There was a problem updating the edit display.");
            }
            finally
            {
                _updatingDisplay = false;
            }
        }