예제 #1
0
        protected void watcher_Changed(object sender, SoftMade.IO.FileSystemEventArgs e)
        {
            if (e.ChangeType == SoftMade.IO.WatcherChangeTypes.BeginWrite)
            {
                return;
            }
            watcher.EnableRaisingEvents = false;

            // Backup current context
            var ctxt = ContextManager.GetInstance().Current;

            // Reload all grammar
            Load(path);

            // Set context back
            ContextManager.GetInstance().SetContext(ctxt);

            // Apply cache to all engines
            foreach (SpeechEngine engine in SpeechManager.GetInstance().Engines.Values)
            {
                engine.Load(Cache, true);
            }

            // Reset context timeout
            ContextManager.GetInstance().ResetContextTimeout();
            watcher.EnableRaisingEvents = true;
        }
예제 #2
0
 protected void audio_Changed(object sender, SoftMade.IO.FileSystemEventArgs e)
 {
     if (e.ChangeType == SoftMade.IO.WatcherChangeTypes.EndWrite)
     {
         Recognize(e.FullPath);
     }
 }