I currently have Cortana implemented into my Silverlight app. The voice commands are stored in CortanaCommands.xml, here is the code:
<?xml version="1.0" encoding="utf-8"?>
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.1">
<CommandSet xml:lang="en-US">
<CommandPrefix>Dr. Bailey</CommandPrefix>
<Example> Open app to take dictation </Example>
<Command Name="Text">
<Example> Is it going to rain? </Example>
<ListenFor> [create] {dictation} </ListenFor>
<Feedback> "" </Feedback>
<Navigate Target="/Views/CortanaText.xaml" />
</Command>
<PhraseTopic Label="dictation" Scenario="Dictation">
<Subject> Cal 123 </Subject>
</PhraseTopic>
</CommandSet>
</VoiceCommands>"
In this example, if the user deploys Cortana and says "Dr. Bailey, is it going to rain?", then the app navigates to the CortanaText.xaml. This is hard coded into the XML, and I want the user to be able to customize their Command Prefix and their Command.
By utilizing 2 textboxes, I have coded in C# a string that contains the entire XML, but inserting the choices from the the text boxes that contain the new Command Prefix and Command. This string is called cortanaXMLstring. What is the best possible way to overwrite the existing code in CortanaCommands.xml with the new string? I figured that would be easier than modifying 2 different areas of the existing XML. I also thought it might be possible to delete the CortanaCommands.xml (using c# code), and then creating that XML all over again by simply inserting the string, since the string contains all of the text needed for the XML? Or, are there any other suggestions on how to get these 2 fields in the XML modified? It's the Command Prefix and the Command Example. Thank you for any help that can be provided!