本文整理汇总了C#中VoiceCommandUserMessage类的典型用法代码示例。如果您正苦于以下问题:C# VoiceCommandUserMessage类的具体用法?C# VoiceCommandUserMessage怎么用?C# VoiceCommandUserMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VoiceCommandUserMessage类属于命名空间,在下文中一共展示了VoiceCommandUserMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: OnRun
protected override async void OnRun(IBackgroundTaskInstance taskInstance)
{
this.serviceDeferral = taskInstance.GetDeferral();
var triggerDetails = taskInstance.TriggerDetails as AppServiceTriggerDetails;
// get the voiceCommandServiceConnection from the tigger details
voiceServiceConnection = VoiceCommandServiceConnection.FromAppServiceTriggerDetails(triggerDetails);
VoiceCommand voiceCommand = await voiceServiceConnection.GetVoiceCommandAsync();
VoiceCommandResponse response;
// switch statement to handle different commands
switch (voiceCommand.CommandName)
{
case "sendMessage":
// get the message the user has spoken
var message = voiceCommand.Properties["message"][0];
//var bot = new Bot();
// get response from bot
string firstResponse = "";
//await bot.SendMessageAndGetResponseFromBot(message);
// create response messages for Cortana to respond
var responseMessage = new VoiceCommandUserMessage();
var responseMessage2 = new VoiceCommandUserMessage();
responseMessage.DisplayMessage =
responseMessage.SpokenMessage = firstResponse;
responseMessage2.DisplayMessage =
responseMessage2.SpokenMessage = "did you not hear me?";
// create a response and ask Cortana to respond with success
response = VoiceCommandResponse.CreateResponse(responseMessage);
await voiceServiceConnection.ReportSuccessAsync(response);
break;
}
if (this.serviceDeferral != null)
{
//Complete the service deferral
this.serviceDeferral.Complete();
}
}
开发者ID:BrianLima,项目名称:QuickForCortana,代码行数:47,代码来源:Service.cs
示例17: Run
public async void Run(IBackgroundTaskInstance taskInstance)
{
serviceDeferral = taskInstance.GetDeferral();
taskInstance.Canceled += OnTaskCanceled;
var triggerDetails = taskInstance.TriggerDetails as AppServiceTriggerDetails;
// Load localized resources for strings sent to Cortana to be displayed to the user.
cortanaResourceMap = ResourceManager.Current.MainResourceMap.GetSubtree("Resources");
// Select the system language, which is what Cortana should be running as.
cortanaContext = ResourceContext.GetForViewIndependentUse();
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 = "Hello!";
userMessage.SpokenMessage = "Your app says hi. It is having a great time.";
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:MaedaNoriyuki,项目名称:WinDevHOLs,代码行数:47,代码来源:HolVoiceCommandService.cs
示例18: OnRun
protected override async void OnRun(IBackgroundTaskInstance taskInstance)
{
this.serviceDeferral = taskInstance.GetDeferral();
taskInstance.Canceled += OnTaskCanceled;
var triggerDetails = taskInstance.TriggerDetails as AppServiceTriggerDetails;
VoiceCommandUserMessage userMessage;
VoiceCommandResponse response;
try
{
voiceServiceConnection = VoiceCommandServiceConnection.FromAppServiceTriggerDetails(triggerDetails);
voiceServiceConnection.VoiceCommandCompleted += VoiceCommandCompleted;
VoiceCommand voiceCommand = await voiceServiceConnection.GetVoiceCommandAsync();
switch (voiceCommand.CommandName)
{
case "getPatientData":
userMessage = new VoiceCommandUserMessage();
userMessage.SpokenMessage = "Here is the Patient Data";
var responseMessage = new VoiceCommandUserMessage();
responseMessage.DisplayMessage = responseMessage.SpokenMessage = "Patient Name: John Spartan\nAge: 47\nBlood Type: O+\nPatient ID: 000S00117";
response = VoiceCommandResponse.CreateResponse(responseMessage);
await voiceServiceConnection.ReportSuccessAsync(response);
break;
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
finally
{
if (this.serviceDeferral != null)
{
//Complete the service deferral
this.serviceDeferral.Complete();
}
}
}
开发者ID:AgentPierce,项目名称:Surgical-Band,代码行数:45,代码来源:bgTask.cs
示例19: SendCompletionMessageForSearchContent
private async void SendCompletionMessageForSearchContent(string content)
{
var userMessage = new VoiceCommandUserMessage();
userMessage.DisplayMessage = "Which one do you wanna see?";
userMessage.SpokenMessage = "Which one do you wanna see?";
var contentItemTiles = new List<VoiceCommandContentTile>();
List<Video> itemData = new List<Video>();
if (content.Equals("movies"))
{
// 电影为 Recommendations 的第 3、4 条
//
itemData.Add(data[2]);
itemData.Add(data[3]);
}
else
{
// 电视剧为 Recommendations 的第 1、2 条
//
itemData.Add(data[0]);
itemData.Add(data[1]);
}
if (data != null)
{
foreach (var item in itemData)
{
contentItemTiles.Add(new VoiceCommandContentTile()
{
ContentTileType = VoiceCommandContentTileType.TitleWith68x68IconAndText,
AppLaunchArgument = item.Id.ToString(),
Title = item.Title,
TextLine1 = item.Desc
});
}
}
var response = VoiceCommandResponse.CreateResponse(userMessage, contentItemTiles);
response.AppLaunchArgument = "";
await voiceServiceConnection.ReportSuccessAsync(response);
}
开发者ID:Yardley999,项目名称:MGTV,代码行数:44,代码来源:VoiceCommandService.cs
示例20: GetSassy
private async void GetSassy()
{
String[] firstPart = { "lazy", "stupid", "insecure", "idiotic", "slimy", "slutty", "smelly", "pompous", "communist", "dicknose", "pie-eating", "racist", "elitist", "trashy", "drug-loving", "butterface", "tone deaf", "ugly", "creepy" };
String[] secondPart = { "douche", "ass", "turd", "rectum", "butt", "cock", "shit", "crotch", "bitch", "prick", "slut", "taint", "fuck", "dick", "boner", "shart", "nut", "sphincter" };
String[] thirdPart = { "pilot", "canoe", "captain", "pirate", "hammer", "knob", "box", "jockey", "nazi", "waffle", "goblin", "blossum", "biscuit", "clown", "socket", "monster", "hound", "dragon", "balloon"};
Random rand = new Random();
String responseText = "Make your own damn coffee you "
+ firstPart[rand.Next(0, firstPart.Length - 1)] + " "
+ secondPart[rand.Next(0, secondPart.Length - 1)] + " "
+ thirdPart[rand.Next(0, thirdPart.Length - 1)] + "!";
var userMessage = new VoiceCommandUserMessage();
userMessage.DisplayMessage = responseText;
userMessage.SpokenMessage = responseText;
var response = VoiceCommandResponse.CreateResponse(userMessage);
await voiceServiceConnection.ReportSuccessAsync(response);
}
开发者ID:Joss-Steward,项目名称:Coffee,代码行数:21,代码来源:CoffeeVoiceService.cs
注:本文中的VoiceCommandUserMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论