public virtual void Stop()
        {
            TextualContextService.PropertyChanged -= OnTextualContextServicePropertyChanged;

            EngineFactory.Release( _engine );
            _engine = null;
            _predictedList.Clear();
        }
Exemplo n.º 2
0
 private static void TestEngine( IWordPredictorEngine engine )
 {
     TextualContextService textualContextService = new TextualContextService();
     textualContextService.SetRawText( "Je" );
     var predicted = engine.Predict( textualContextService, 20 );
     Assert.That( predicted, Is.Not.Null );
     Assert.That( predicted.Count() > 0 );
 }
 public void Release( IWordPredictorEngine engine )
 {
     var disposable = engine as IDisposable;
     if( disposable != null )
     {
         disposable.Dispose();
     }
 }
 protected virtual void OnFeaturePropertyChanged( object sender, PropertyChangedEventArgs e )
 {
     if( e.PropertyName == "Engine" )
     {
         EngineFactory.Release( _engine );
         _engine = null;
         LoadEngine();
     }
 }
 private void LoadEngine()
 {
     _asyncEngineContinuation = EngineFactory.CreateAsync( Feature.Engine ).ContinueWith( task =>
     {
         if( _engine == null ) _engine = task.Result;
     } );
 }
 private void LoadEngine()
 {
     //the engine load can be fail
     _asyncEngineContinuation = EngineFactory.CreateAsync( Feature.Service.Engine ).ContinueWith( task =>
     {
         if( _engine == null ) _engine = task.Result;
     }, TaskContinuationOptions.NotOnCanceled );
 }