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


C# VoiceCommandUserMessage类代码示例

本文整理汇总了C#中VoiceCommandUserMessage的典型用法代码示例。如果您正苦于以下问题:C# VoiceCommandUserMessage类的具体用法?C# VoiceCommandUserMessage怎么用?C# VoiceCommandUserMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VoiceCommandUserMessage类属于命名空间,在下文中一共展示了VoiceCommandUserMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowProgressScreen

        /// <summary>
        /// Show a progress screen. These should be posted at least every 5 seconds for a 
        /// long-running operation, such as accessing network resources over a mobile 
        /// carrier network.
        /// </summary>
        /// <param name="message">The message to display, relating to the task being performed.</param>
        /// <returns></returns>
        protected async Task ShowProgressScreen(string message) {
            var userProgressMessage = new VoiceCommandUserMessage();
            userProgressMessage.DisplayMessage = userProgressMessage.SpokenMessage = message;

            VoiceCommandResponse response = VoiceCommandResponse.CreateResponse(userProgressMessage);
            await voiceServiceConnection.ReportProgressAsync(response);
        }
开发者ID:Vedolin,项目名称:wheelmap-windows-app,代码行数:14,代码来源:VoiceCommandHandler.cs

示例2: Run

        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            // Create the deferral by requesting it from the task instance
            serviceDeferral = taskInstance.GetDeferral();

            AppServiceTriggerDetails triggerDetails = taskInstance.TriggerDetails as AppServiceTriggerDetails;

            if (triggerDetails != null && triggerDetails.Name.Equals("IMCommandVoice"))
            {
                voiceServiceConnection = VoiceCommandServiceConnection.FromAppServiceTriggerDetails(triggerDetails);

                VoiceCommand voiceCommand = await voiceServiceConnection.GetVoiceCommandAsync();

                // Perform the appropriate command depending on the operation defined in VCD
                switch (voiceCommand.CommandName)
                {
                    case "oldback":
                        VoiceCommandUserMessage userMessage = new VoiceCommandUserMessage();
                        userMessage.DisplayMessage = "The current temperature is 23 degrees";
                        userMessage.SpokenMessage = "The current temperature is 23 degrees";

                        VoiceCommandResponse response = VoiceCommandResponse.CreateResponse(userMessage, null);
                        await voiceServiceConnection.ReportSuccessAsync(response);
                        break;

                    default:
                        break;
                }
            }

            // Once the asynchronous method(s) are done, close the deferral
            serviceDeferral.Complete();
        }
开发者ID:lcarli,项目名称:IntelliMarketing,代码行数:33,代码来源:IMCommandVoice.cs

示例3: SendAnswer

        private async Task SendAnswer()
        {
            var destContentTiles = new List<VoiceCommandContentTile>();
            
            var destTile = new VoiceCommandContentTile()
            {
                ContentTileType = VoiceCommandContentTileType.TitleWithText,
                Title = "Leaderboard",
                TextLine1 = "1. Vladimir - 9337\n2. Petri - 8000"
            };
            destContentTiles.Add(destTile);
        
            var userMessagePlay = new VoiceCommandUserMessage();
            userMessagePlay.DisplayMessage = "Do you want to play?";
            userMessagePlay.SpokenMessage = "Yes, you are 1337 points behind Vladimir. Do you want to play?";

            var userMessagePlay2 = new VoiceCommandUserMessage();
            userMessagePlay2.DisplayMessage = "You are far behind. Do you want to play the game?";
            userMessagePlay2.SpokenMessage = "You are far behind. Do you want to play the game now?";

            var resp2 = VoiceCommandResponse.CreateResponseForPrompt(userMessagePlay, userMessagePlay2, destContentTiles);
            var confResp2 = await voiceServiceConnection.RequestConfirmationAsync(resp2);

            if(confResp2.Confirmed)
            {
                var umP = new VoiceCommandUserMessage();
                umP.DisplayMessage = "Do you want to play?";
                umP.SpokenMessage = "You are 1337 points behind Vladimir. Do you want to play?";

                var resp3 = VoiceCommandResponse.CreateResponse(umP);

                await voiceServiceConnection.RequestAppLaunchAsync(resp3);
            }
        }
开发者ID:Tapanito,项目名称:F20CA,代码行数:34,代码来源:BotWorldVoiceCommandService.cs

示例4: ShowLatestNews

        private async Task ShowLatestNews()
        {
            string progress = "Getting the latest news...";
            await ShowProgressScreen(progress);
            RssService feedService = new RssService();
            var news = await feedService.GetNews("http://blog.qmatteoq.com/feed");

            List<VoiceCommandContentTile> contentTiles = new List<VoiceCommandContentTile>();

            VoiceCommandUserMessage message = new VoiceCommandUserMessage();
            string text = "Here are the latest news";
            message.DisplayMessage = text;
            message.SpokenMessage = text;

            foreach (FeedItem item in news.Take(5))
            {
                VoiceCommandContentTile tile = new VoiceCommandContentTile();
                tile.ContentTileType = VoiceCommandContentTileType.TitleOnly;
                tile.Title = item.Title;
                tile.TextLine1 = item.PublishDate.ToString("g");

                contentTiles.Add(tile);
            }

            VoiceCommandResponse response = VoiceCommandResponse.CreateResponse(message, contentTiles);
            await _voiceServiceConnection.ReportSuccessAsync(response);

        }
开发者ID:qmatteoq,项目名称:dotNetSpainConference2016,代码行数:28,代码来源:SpeechTask.cs

示例5: FindSessionsByTag

        private async Task FindSessionsByTag(string tags)
        {
            try
            {
                var list = _agendaService.FindSessionsByKeyword(tags);
                var results = list.Where(f => f.Value > 0).OrderByDescending(f => f.Value).Select(l => l.Key).Take(10).ToList();

                var userMessage = new VoiceCommandUserMessage();
                if (results.Any())
                {
                    userMessage.DisplayMessage = "Showing top " + results.Count() + " sessions related to " + tags;
                    userMessage.SpokenMessage = "Showing top " + results.Count() + " sessions related to " + tags;
                }
                else
                {
                    userMessage.DisplayMessage = "There are no results for " + tags;
                    userMessage.SpokenMessage = "There are no results for " + tags;
                }
                await ShowResults(results, userMessage);
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
            }
        }
开发者ID:thewindev,项目名称:CodecampUWP,代码行数:25,代码来源:CodecampSessionsVoiceCommandService.cs

示例6: LaunchAppInForeground

 private async void LaunchAppInForeground()
 {
     var userMessage = new VoiceCommandUserMessage();
     userMessage.SpokenMessage = "开启 App 中...请稍后";
     var response = VoiceCommandResponse.CreateResponse(userMessage);
     response.AppLaunchArgument = "";
     await vcConnection.RequestAppLaunchAsync(response);
 }
开发者ID:poumason,项目名称:DotblogsSampleCode,代码行数:8,代码来源:VCBusService.cs

示例7: Run

        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            serviceDeferral = taskInstance.GetDeferral();
            taskInstance.Canceled += OnTaskCanceled;

            var triggerDetails = taskInstance.TriggerDetails as AppServiceTriggerDetails;

            cortanaResourceMap = ResourceManager.Current.MainResourceMap.GetSubtree("Resources");

            cortanaContext = ResourceContext.GetForViewIndependentUse();

            dateFormatInfo = CultureInfo.CurrentCulture.DateTimeFormat;

            if (triggerDetails != null && triggerDetails.Name == "DomojeeVoiceCommandService")
            {
                try
                {
                    voiceServiceConnection =
                        VoiceCommandServiceConnection.FromAppServiceTriggerDetails(
                            triggerDetails);

                    voiceServiceConnection.VoiceCommandCompleted += OnVoiceCommandCompleted;

                    VoiceCommand voiceCommand = await voiceServiceConnection.GetVoiceCommandAsync();
                    var userMessage = new VoiceCommandUserMessage();
                    string message = "";


                    // Ajout d'une requet jeedom pour retrouver la commande
                    switch (voiceCommand.CommandName)
                    {
                        case "JeedomInteractList":
                            string CortanaVoiceCommande= voiceCommand.Properties["InteractList"][0];
                            await Jeedom.RequestViewModel.Instance.interactTryToReply(CortanaVoiceCommande);
                            message = Jeedom.RequestViewModel.Instance.InteractReply;
                            break;
                        default:
                            LaunchAppInForeground();
                            break;
                    }

                    userMessage.DisplayMessage = message;
                    userMessage.SpokenMessage = message;
                    

            var response = VoiceCommandResponse.CreateResponse(userMessage);
            response.AppLaunchArgument = message;


                await voiceServiceConnection.ReportSuccessAsync(response);
            }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("Handling Voice Command failed " + ex.ToString());
                }
            }
        }
开发者ID:phabrys,项目名称:Domojee,代码行数:57,代码来源:DomojeeVoiceCommandService.cs

示例8: LaunchAppInForeground

 /// <summary>
 /// Provide a simple response that launches the app. Expected to be used in the
 /// case where the voice command could not be recognized (eg, a VCD/code mismatch.)
 /// </summary>
 protected async Task LaunchAppInForeground(VoiceCommandUserMessage userMessage = null, string args = null) {
     if (userMessage == null) {
         userMessage = new VoiceCommandUserMessage();
         userMessage.SpokenMessage = "OPEN_APP_SpokenMessage".t(context, R.File.CORTANA);
         userMessage.DisplayMessage = "OPEN_APP_DisplayMessage".t(context, R.File.CORTANA);
     }
     var response = VoiceCommandResponse.CreateResponse(userMessage);
     response.AppLaunchArgument = args ?? "";
     await voiceServiceConnection.RequestAppLaunchAsync(response);
 }
开发者ID:Vedolin,项目名称:wheelmap-windows-app,代码行数:14,代码来源:VoiceCommandHandler.cs

示例9: launchAppInForeground

        private async void launchAppInForeground()
        {
            var userMessage = new VoiceCommandUserMessage();
            userMessage.SpokenMessage = "Launching superGame";

            var response = VoiceCommandResponse.CreateResponse(userMessage);

            response.AppLaunchArgument = "";

            await voiceServiceConection.RequestAppLaunchAsync(response);            
        }
开发者ID:arkiq,项目名称:myCortana,代码行数:11,代码来源:superGameVoiceService.cs

示例10: SendProgressMessageAsync

        private async Task SendProgressMessageAsync(string message)
        {
            var progressmessage = new VoiceCommandUserMessage();

            progressmessage.DisplayMessage =
                progressmessage.SpokenMessage = message;
            // Show progress message
            // Affiche le message de progression
            var response = VoiceCommandResponse.CreateResponse(progressmessage);

            await _voiceCommandServiceConnection.ReportProgressAsync(response);
        }
开发者ID:Guruumeditation,项目名称:Article-CortanaAzureSearch,代码行数:12,代码来源:PresidentsService.cs

示例11: sendCompletionMessageForHighScorer

        private async void sendCompletionMessageForHighScorer()
        {
            // longer than 0.5 seconds, then progress report has to be sent
            string progressMessage = "Finding the highest scorer";
            await ShowProgressScreen(progressMessage);

            var userMsg = new VoiceCommandUserMessage();
            userMsg.DisplayMessage = userMsg.SpokenMessage = "The person with the highest score is Damien";

            VoiceCommandResponse response = VoiceCommandResponse.CreateResponse(userMsg);
            await voiceServiceConection.ReportSuccessAsync(response);
        }
开发者ID:arkiq,项目名称:myCortana,代码行数:12,代码来源:superGameVoiceService.cs

示例12: SendCompletionMessageForOnOff

        private async Task SendCompletionMessageForOnOff(RelayNodeClient client, string target, bool turnItOn)
        {
            var userMessage = new VoiceCommandUserMessage();

            if (!client.IsReady)
            {
                string noController = string.Format(
                                       cortanaResourceMap.GetValue("noControllerFound", cortanaContext).ValueAsString,
                                       target);
                userMessage.DisplayMessage = noController;
                userMessage.SpokenMessage = noController;
            }
            else
            {
                int relayId = 0;
                switch (target)
                {
                    default:
                    case "light":
                    case "lamp":
                        relayId = 0;
                        break;
                    case "fan":
                        relayId = 1;
                        break;
                }

                if (turnItOn)
                {
                    client.SetRelay(relayId, true);
                    string turnedOn = string.Format(
                                           cortanaResourceMap.GetValue("turnedOnMessage", cortanaContext).ValueAsString,
                                           target);
                    userMessage.DisplayMessage = turnedOn;
                    userMessage.SpokenMessage = turnedOn;
                }
                else
                {
                    client.SetRelay(relayId, false);
                    string turnedOn = string.Format(
                                           cortanaResourceMap.GetValue("turnedOffMessage", cortanaContext).ValueAsString,
                                           target);
                    userMessage.DisplayMessage = turnedOn;
                    userMessage.SpokenMessage = turnedOn;
                }
            }

            //var response = VoiceCommandResponse.CreateResponse(userMessage, destinationsContentTiles);
            var response = VoiceCommandResponse.CreateResponse(userMessage);
            await voiceServiceConnection.ReportSuccessAsync(response);
        }
开发者ID:martincalsyn,项目名称:CortanaAllJoynDemo,代码行数:51,代码来源:VoiceCommandService.cs

示例13: Run

        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            serviceDeferral = taskInstance.GetDeferral();

            taskInstance.Canceled += OnTaskCanceled;

            var triggerDetails = taskInstance.TriggerDetails as AppServiceTriggerDetails;

            if (triggerDetails != null && triggerDetails.Name == "HolVoiceCommandService")
            {
                try
                {
                    voiceServiceConnection =
                                    VoiceCommandServiceConnection.FromAppServiceTriggerDetails(
                                        triggerDetails);

                    voiceServiceConnection.VoiceCommandCompleted += OnVoiceCommandCompleted;


                    VoiceCommand voiceCommand = await voiceServiceConnection.GetVoiceCommandAsync();

                    switch (voiceCommand.CommandName)
                    {
                        case "SayHello":

                            var userMessage = new VoiceCommandUserMessage();
                            userMessage.DisplayMessage = "お店で合言葉話してね。";
                            userMessage.SpokenMessage = "ごきげんよう。";

                            var response = VoiceCommandResponse.CreateResponse(userMessage);

                            await voiceServiceConnection.ReportSuccessAsync(response);

                            break;


                        default:
                            break;
                    }


                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("Handling Voice Command failed " + ex.ToString());
                }
            }


        }
开发者ID:nksato,项目名称:UWP-Samples-CortanaSpeechRecognition,代码行数:50,代码来源:HolVoiceCommandService.cs

示例14: ShowEndMyPresentation

        private async void ShowEndMyPresentation()
        {
            var userMessage = new VoiceCommandUserMessage();

            //string message = "Okay Oliver, ich starte jetzt deinen Vortrag und wünsch Dir viel Erfolg.";

            string message = "Oliver! Mein Name ist nicht Siri. Und du solltest mich lieber nicht noch mal so ansprechen, sonst bin ich echt sauer.";

            userMessage.SpokenMessage = message;
            userMessage.DisplayMessage = message;

            var response = VoiceCommandResponse.CreateResponse(userMessage);
            await voiceServiceConnection.ReportSuccessAsync(response);
        }
开发者ID:MicrosoftDXGermany,项目名称:Windows-10-Feature-Demos,代码行数:14,代码来源:VoiceCommandService.cs

示例15: DoSomething

 private async void DoSomething(string classname)
 {
     SubstitutionSchedules.LoadSubstitutionSchedulesFromWeb loader = new SubstitutionSchedules.LoadSubstitutionSchedulesFromWeb();
     List<string> list = await loader.LoadSchoolClassWithSubstitutionNames(DateTime.Today);
     VoiceCommandUserMessage answer = new VoiceCommandUserMessage();
     bool hasSubstitution = list.Contains<string>(classname);
     if(hasSubstitution)
     {
         answer.DisplayMessage = "Ja";
     }
     else
     {
         answer.DisplayMessage = "Nein";
     }
 }
开发者ID:Flogex,项目名称:Vertretungsplan,代码行数:15,代码来源:SubstitutionSchedulesVoiceCommandService.cs


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