예제 #1
0
        /// <summary>
        /// this is called when XCore wants to display something that relies on the list with the id "WritingSystemList"
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="display"></param>
        /// <returns></returns>
        public bool OnDisplayWritingSystemList(object parameter, ref UIListDisplayProperties display)
        {
            CheckDisposed();

            display.List.Clear();
            FdoCache         cache    = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
            string           wsSet    = parameter as string;
            WritingSystemSet setToUse = m_currentSet;

            if (wsSet != null)
            {
                // JohnT: This is a patch to fix LT-5059. The problem is that the WritingSystemList set
                // (with the pronunciation subset) is used in the Pronuciation field pull-down menu.
                // All other code that I can find currently does not specify it. Therefore, after this
                // menu is displayed once, m_currentSet is set to pronunciation and stays there.
                // It seems that we actually have no current use for any other subset, nor for remembering
                // the most recent one specified. However, in the interests of making the change minimal,
                // and in case there is some anticipated application of tracking the current set which
                // I am not aware of, I made a way for that one menu item to get the list it needs
                // without making a persistent change.
                string tempPrefix = "temp:";
                bool   fTemp      = wsSet.StartsWith(tempPrefix);
                if (fTemp)
                {
                    setToUse = DecodeSetName(wsSet.Substring(tempPrefix.Length));
                }
                else
                {
                    m_currentSet = setToUse = DecodeSetName(wsSet);
                }
            }
            switch (setToUse)
            {
            default:
                throw new NotImplementedException("That writing system set needs to be implemented");

            case WritingSystemSet.All:
                AddWritingSystemList(display, cache.LangProject.GetAllNamedWritingSystems());
                break;

            case WritingSystemSet.AllCurrent:
                AddWritingSystemList(display, cache.LangProject.GetActiveNamedWritingSystems());
                break;

            case WritingSystemSet.CurrentAnalysis:
                AddWritingSystemList(display, cache.LangProject.CurAnalysisWssRS);
                break;

            case WritingSystemSet.CurrentVernacular:
                AddWritingSystemList(display, cache.LangProject.CurVernWssRS);
                break;

            case WritingSystemSet.CurrentPronounciation:
                AddWritingSystemList(display, cache.LangProject.GetPronunciationWritingSystems());
                string sValue = CmObject.JoinIds(cache.LangProject.CurPronunWssRS.HvoArray, ",");
                m_mediator.PropertyTable.SetProperty("PronunciationWritingSystemHvos", sValue);
                break;
            }
            return(true);           //we handled this, no need to ask anyone else.
        }