示例#1
0
 internal void SetEnabledFlag(bool value, bool switchContext)
 {
     try
     {
         if (_enabled != value)
         {
             _enabled = value;
             if (!_enabled)
             {
                 if (_voice.Equals(_voiceSynthesizer.CurrentVoice(switchContext).VoiceInfo))
                 {
                     _voiceSynthesizer.Voice = null;
                 }
             }
             else
             {
                 _voiceSynthesizer.Voice = null;
             }
         }
     }
     catch (InvalidOperationException)
     {
         _voiceSynthesizer.Voice = null;
     }
 }