Esempio n. 1
0
 public bool CallNextAlternateGroup()
 {
     if (_CurrentPinyinCollection.Count <= (_CurrentPinyinIndex + 1))
     {
         _CurrentPinyinIndex = 0;
         return(false);
     }
     _CurrentPinyinIndex++;
     char[] r = Pinyin.GetCharArrayOfPinyin(_CurrentPinyinCollection[_CurrentPinyinIndex]);
     if (r != null && r.Length > 0)
     {
         _CurrentResult = new char[r.Length];
         Array.Copy(r, _CurrentResult, r.Length);
         ClearAlternates();
         if (r.Length > WORD_COUNT)
         {
             HasLast = true;
         }
         for (int i = 0; i < WORD_COUNT; i++)
         {
             if (i < r.Length)
             {
                 Add(r[_CurrentPage * i].ToString(CultureInfo.InvariantCulture));
             }
         }
     }
     if (r == null || r.Length == 0)
     {
         ClearAlternates();
     }
     return(true);
 }
Esempio n. 2
0
 /// <summary>
 ///     当拼音框中的拼音已经分割好事件的处理
 /// </summary>
 private void SeparatorOnPinyinSeparated(object sender, PinyinSeparatedEventArgs e)
 {
     try
     {
         _CurrentPinyinCollection = e.Pinyin;
         _CurrentPinyinIndex      = 0;
         char[] r = Pinyin.GetCharArrayOfPinyin(_CurrentPinyinCollection[_CurrentPinyinIndex]);
         if (r != null && r.Length > 0)
         {
             _CurrentResult = new char[r.Length];
             Array.Copy(r, _CurrentResult, r.Length);
             ClearAlternates();
             if (r.Length > WORD_COUNT)
             {
                 HasLast = true;
             }
             for (int i = 0; i < WORD_COUNT; i++)
             {
                 if (i < r.Length)
                 {
                     Add(r[_CurrentPage * i].ToString(CultureInfo.InvariantCulture));
                 }
             }
         }
         if (_CurrentPinyinCollection.Count == 1 && (r == null || r.Length == 0))
         {
             ClearAlternates();
         }
     }
     catch (Exception ex)
     {
         _logger.Warn(string.Format("OnPinyinSeparated异常:{0}", ex.Message));
     }
 }