コード例 #1
0
        private void _scriptsAndVariants_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // This is a Script link, so for now we'll limit the dialog to only the ScriptRegionVariant combo option.
            var wsSetupModel = new WritingSystemSetupModel(new WritingSystemDefinition(_model.SelectedLanguage.LanguageTag),
                                                           WritingSystemSetupModel.SelectionsForSpecialCombo.ScriptRegionVariant, false);

            wsSetupModel.IdentifierScriptRegionVariantSelected();
            using (var dlg = new ScriptsAndVariantsDialog())
            {
                dlg.BindToModel(wsSetupModel);
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                // Allow the user to think of the the Script and Variant's Abbreviation as the primary language tag
                // for unlisted languages.  Otherwise, why show it or allow it to be edited?
                var tag  = wsSetupModel.CurrentDefinition.LanguageTag;
                var abbr = wsSetupModel.CurrentDefinition.Abbreviation;
                if (tag.Length >= 3 && LanguageSubtag.IsUnlistedCode(tag.Substring(0, 3)) &&
                    abbr.Length == 3 && LanguageSubtag.IsUnlistedCode(abbr) &&
                    abbr != tag.Substring(0, 3))
                {
                    tag = abbr + tag.Substring(3);
                }
                _model.SelectedLanguage.LanguageTag = tag;
                UpdateReadiness();
            }
        }
コード例 #2
0
        private void _scriptsAndVariants_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // This is a Script link, so for now we'll limit the dialog to only the ScriptRegionVariant combo option.
            var wsSetupModel = new WritingSystemSetupModel(new WritingSystemDefinition(_model.SelectedLanguage.LanguageTag),
                                                           WritingSystemSetupModel.SelectionsForSpecialCombo.ScriptRegionVariant, false);

            wsSetupModel.IdentifierScriptRegionVariantSelected();
            using (var dlg = new ScriptsAndVariantsDialog())
            {
                dlg.BindToModel(wsSetupModel);
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                _model.SelectedLanguage.LanguageTag = wsSetupModel.CurrentDefinition.LanguageTag;
                UpdateReadiness();
            }
        }