当前位置: 首页>>代码示例>>C#>>正文


C# Logger.Dispose方法代码示例

本文整理汇总了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();
                            }
        }
开发者ID:TommyAGK,项目名称:Flex3,代码行数:45,代码来源:Speaker.cs

示例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();

                            }
        }
开发者ID:TommyAGK,项目名称:Flex3,代码行数:55,代码来源:Speaker.cs


注:本文中的System.Logger.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。