private void PerformSearch() { UseWaitCursor = true; // Try to search by character code first... lastSearchResults = UnicodeCharacterDatabase.FindCharactersByCodeString(SearchQuery); // ...If that fails, search characters by name. if (lastSearchResults == null || lastSearchResults.Count == 0) { if (SearchQuery.Contains(" ") && SearchQuery.Trim().Length > 0) { string[] filterParts = SearchQuery.Split(namePartSeparators, StringSplitOptions.RemoveEmptyEntries); string regexPattern = string.Join(@".*?", filterParts); lastSearchResults = UnicodeCharacterDatabase.FindCharactersByNameRegex(regexPattern); } else { lastSearchResults = UnicodeCharacterDatabase.FindCharactersByName(SearchQuery, false); } } gridResultDisplayer.Rows.Clear(); gridResultDisplayer.RowCount = lastSearchResults.Count; if (!Focused) { gridResultDisplayer.ClearSelection(); } UseWaitCursor = false; }
private void LoadFavorites() { List <Label> favoriteControls = new List <Label> { lblFavoriteGlyph0, lblFavoriteGlyph1, lblFavoriteGlyph2, lblFavoriteGlyph3, lblFavoriteGlyph4, lblFavoriteGlyph5, lblFavoriteGlyph6, lblFavoriteGlyph7, lblFavoriteGlyph8, lblFavoriteGlyph9, }; for (int i = 0; i < UserSettings.Instance.Favorites.Length; i++) { if (UserSettings.Instance.Favorites[i] > 0) { ushort charCode = UserSettings.Instance.Favorites[i]; favoriteControls[i].Text = (((char)charCode).ToString()); string toolTipText = string.Format("{0:X4} - {1}", charCode, UnicodeCharacterDatabase.GetCharacterName(charCode)); toolTip.SetToolTip(favoriteControls[i], toolTipText); } else { favoriteControls[i].Text = string.Empty; toolTip.SetToolTip(favoriteControls[i], null); } } }
private void PlaceCharacterIntoRow(int rowIndex, ushort charCode) { gridFavorites[colCharacterCode.Index, rowIndex].Value = charCode != 0 ? charCode.ToString("X4") : string.Empty; gridFavorites[colCharacterGlyph.Index, rowIndex].Value = charCode != 0 ? ((char)charCode).ToString() : string.Empty; gridFavorites[colCharacterName.Index, rowIndex].Value = charCode != 0 ? UnicodeCharacterDatabase.GetCharacterName(charCode) : string.Empty; }