コード例 #1
0
        private void ReloadWsCombo()
        {
            m_wsInfo.Clear();
            cbWS.ClearItems();
            cbWS.Sorted = true;
            foreach (var ws in m_cache.ServiceLocator.WritingSystemManager.WritingSystems)
            {
                var wsi = new WsInfo(ws.DisplayLabel, ws.Id, ws.LegacyMapping);
                m_wsInfo.Add(wsi.KEY, wsi);
                cbWS.Items.Add(wsi);
            }

            cbWS.Sorted = false;
            // Add the special "ignore" WsInfo
            cbWS.Items.Add(new WsInfo());
        }
コード例 #2
0
        private void PopulateVariantCombo(bool fPreserve)
        {
            m_variantName.TextChanged -= m_variantName_TextChanged;             // don't modify the WS while fixing up the combo.
            m_variantName.BeginUpdate();
            IEnumerable <VariantSubtag> orig = VariantSubtags;

            m_variantName.ClearItems();
            m_variantName.Items.AddRange(StandardSubtags.RegisteredVariants.Concat(StandardSubtags.CommonPrivateUseVariants)
                                         .Where(v => v.IsVariantOf(m_ws.LanguageTag)).Cast <object>().ToArray());
            if (orig != null && fPreserve)
            {
                VariantSubtags = orig;
            }
            m_variantName.EndUpdate();
            m_variantName.TextChanged += m_variantName_TextChanged;
        }
コード例 #3
0
        private void PopulateVariantCombo(bool fPreserve)
        {
            m_variantName.TextChanged -= m_variantName_TextChanged;             // don't modify the WS while fixing up the combo.
            m_variantName.BeginUpdate();
            VariantSubtag orig = VariantSubtag;

            m_variantName.ClearItems();
            m_variantName.Items.AddRange((from subtag in LangTagUtils.VariantSubtags
                                          where subtag.IsVariantOf(m_ws.Id)
                                          select subtag).ToArray());
            if (orig != null && fPreserve)
            {
                VariantSubtag = orig;
            }
            m_variantName.EndUpdate();
            m_variantName.TextChanged += m_variantName_TextChanged;
        }
コード例 #4
0
        /// <summary>
        /// Load the controls from the writing system, if it is not null. If it is null, clear all controls.
        /// If the combo boxes are not populated, do nothing...the method will get called again
        /// when the form loads.
        /// </summary>
        private void LoadControlsFromWritingSystem()
        {
            m_enableLangTagSideEffects = false;
            if (m_ws == null)
            {
                return;                 // Probably in design mode; can't populate.
            }
            m_origVariantSubtag = m_ws.VariantSubtag;
            m_origRegionSubtag  = m_ws.RegionSubtag;
            m_origScriptSubtag  = m_ws.ScriptSubtag;
            m_scriptName.ClearItems();
            m_scriptName.Items.AddRange(LangTagUtils.ScriptSubtags.ToArray());
            ScriptSubtag = m_origScriptSubtag;

            m_regionName.ClearItems();
            m_regionName.Items.AddRange(LangTagUtils.RegionSubtags.ToArray());
            RegionSubtag = m_origRegionSubtag;

            PopulateVariantCombo(false);
            VariantSubtag = m_origVariantSubtag;
            m_enableLangTagSideEffects = true;
        }