/// <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)); } }
/// <summary> /// 当连续的拼音字符串分割完成时发生 /// </summary> protected virtual void OnPinyinSeparated(PinyinSeparatedEventArgs e) { EventHandler <PinyinSeparatedEventArgs> handler = PinyinSeparated; if (handler != null) { handler(this, e); } }