CK.WordPredictor.SimplePredictedWordSender.OnWordPredictionSuccessful C# (CSharp) Method

OnWordPredictionSuccessful() protected method

protected OnWordPredictionSuccessful ( object sender, WordPredictionSuccessfulEventArgs e ) : void
sender object
e CK.WordPredictor.Model.WordPredictionSuccessfulEventArgs
return void
        protected virtual void OnWordPredictionSuccessful( object sender, WordPredictionSuccessfulEventArgs e )
        {
            if( TextualContextService.Service != null && SendStringService.Service != null )
            {
                int caretOffset = TextualContextService.Service.CaretOffset;
                if( e.Word.Length > 0 && e.Word.Length > caretOffset )
                {
                    string wordToSend = e.Word;

                    if( TextualContextService.Service.CurrentToken != null
                        && e.Word.Substring( 0, caretOffset ).Equals( TextualContextService.Service.CurrentToken.Value, StringComparison.InvariantCultureIgnoreCase ) )
                    {
                        wordToSend = e.Word.Substring( caretOffset, e.Word.Length - caretOffset );
                    }

                    if( Feature.InsertSpaceAfterPredictedWord && !wordToSend.EndsWith( "'" ) ) wordToSend += " ";

                    SendStringService.Service.SendString( wordToSend );
                }
            }
        }