protected virtual void OnResultSubmitted(CharacterSearchResultEventArgs e)
 {
     if (ResultSubmitted != null)
     {
         ResultSubmitted(this, e);
     }
 }
        private void frmCharacterLookup_ResultSubmitted(object sender, CharacterSearchResultEventArgs e)
        {
            switch (e.Result.Action)
            {
                case CharacterSearchAction.Cancel:
                    break;

                case CharacterSearchAction.InsertCharacter:
                    if (!e.Result.KeepApplicationActive)
                    {
                        HideApplication();
                    }

                    try
                    {
                        UnicodeCharSender.Send(hTargetWindow, e.Result.CharacterCode);
                    }
                    catch (Exception ex)
                    {
                        ShowErrorMessage(LocalizationHelper.GetResource(this, "msgSendCharFailed"), ex);
                    }

                    if (e.Result.KeepApplicationActive)
                    {
                        NativeMethods.SetForegroundWindow(Handle);
                    }
                    break;

                case CharacterSearchAction.CopyCharacterToClipboard:
                    Clipboard.SetText(((char)e.Result.CharacterCode).ToString());
                    HideApplication();
                    break;

                case CharacterSearchAction.AddCharacterToFavorites:
                    int? selectedIndex = AddToFavoritesForm.Execute(e.Result.CharacterCode, this);
                    if (selectedIndex.HasValue)
                    {
                        UserSettings.Instance.Favorites[selectedIndex.Value] = e.Result.CharacterCode;
                        UserSettings.Instance.Save(false);
                        LoadFavorites();
                    }
                    break;
            }
        }