本文整理汇总了C#中System.Logger.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.Dispose方法的具体用法?C# Logger.Dispose怎么用?C# Logger.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Logger
的用法示例。
在下文中一共展示了Logger.Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Speaker
public Speaker(Language.Country language)
{
//ensure bools are defaulted to off.
AsyncMode = false;
UseSSML = false;
_language = language;
ss = new SpeechSynthesizer();
ss.SetOutputToDefaultAudioDevice();
try
{
if (UseSSML)
{
return;
}
switch (_language)
{
case Language.Country.eng:
ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)");
break;
case Language.Country.fin:
ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (fi-FI, Heidi)");
break;
case Language.Country.nor:
ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (nb-NO, Hulda)");
break;
case Language.Country.rus:
ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (ru-RU, Elena)");
break;
case Language.Country.swe:
ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (sv-SE, Hedvig)");
break;
default:
ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)");
break;
}
}
catch (NullReferenceException e)
{
// Woop.
Logger logging = new Logger(true);
logging.Report(ToString(), e.StackTrace);
logging.Dispose();
}
}
示例2: Speak
//default the speed to "no change"
public void Speak(string message, int speed = 0)
{
try
{
PromptBuilder builder = new PromptBuilder();
builder.AppendText(message);
//suddenly voices!
ss.Rate = speed;
if (UseSSML)
{
string ssmlString = "<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\"";
switch (_language)
{
case Language.Country.eng:
ssmlString += " xml:lang=\"en-GB\">";
break;
case Language.Country.fin:
ssmlString += " xml:lang=\"fi-FI\">";
break;
case Language.Country.nor:
ssmlString += " xml:lang=\"nb-NO\">";
break;
case Language.Country.rus:
ssmlString += " xml:lang=\"ru-RU\">";
break;
case Language.Country.swe:
ssmlString += " xml:lang=\"sv-SE\">";
break;
default:
ssmlString += " xml:lang=\"en-GB\">";
break;
}
ssmlString += "<s>" + message + "</s/></speak>";
if (AsyncMode)
{
ss.SpeakSsmlAsync(ssmlString);
}
else
{
ss.SpeakSsml(ssmlString);
}
}
}
catch (Exception e)
{
Logger logging = new Logger(true);
logging.Report(ToString(), e.StackTrace);
logging.Dispose();
}
}