public void Initialize()
        {
            Recognizer?.Stop();

            _handler = new SpeechTextHandler();

            var casts = GetCasts().ToDictionary(x => x.ID);

            var activators = new List <ActivationWord>();

            foreach (var scenId in VoicePluginData.Current.WithoutActivationVoiceScenariosIds)
            {
                if (casts.ContainsKey(scenId))
                {
                    activators.Add(new SimpleScenarioActivator(casts[scenId]));
                }
            }

            foreach (var keyword in VoicePluginData.Current.Keywords)
            {
                activators.Add(new ActivatorWord_StartGoogleRecognition(keyword));
            }

            Recognizer = new GoogleSpeechRecognizer(
                new Output(_needCasts, _handler),
                activators.ToArray(),
                VoicePluginData.Current.ActivationConfidence,
                VoicePluginData.Current.ExecutionConfidence,
                VoicePluginData.Current.CaptureDevice);

            Recognizer.Stopped += (o, e) => ValueChanged?.Invoke(this, ToggleValueType.ValueOFF);
        }
 public Output(Func <ScenarioCast[]> needCasts, SpeechTextHandler handler)
 {
     _needCasts = needCasts;
     _handler   = handler;
 }