2014-02-14 12 views
0

我的解决方案中有一个名为“Voicecmd.xml”的文件,需要以编程方式写入。我怎么做?如何使用构建操作写入文件“Content”

代码用于更新/编辑voicecmd并在那里我卡住了...

async void updateall() 
{ 
    XDocument xDoc = XDocument.Load("voicecmd.xml"); 
    var ns = XNamespace.Get("http://schemas.microsoft.com/voicecommands/1.0"); 
    texb.Text = xDoc.Root.Element(ns + "CommandSet").Element(ns + "CommandPrefix").Value; 
} 

    private async void ttcc(object sender, TextChangedEventArgs e) 
    { 

     XDocument xDoc = XDocument.Load("voicecmd.xml"); 
     var ns = XNamespace.Get("http://schemas.microsoft.com/voicecommands/1.0"); 
     xDoc.Root.Element(ns + "CommandSet").Element(ns + "CommandPrefix").Value = texb.Text; 
     // xDoc.Save(StreamWriter); 
    } 

回答

0

看来你可以写,甚至项目文件。这是一个link

否则,您可以随时将其复制到IsolatedStorage并写信给它。

+0

该文件正在讨论win8/rt。我需要WP8。 – Kevin

+0

它应该是相似的 –

+0

它似乎是。编辑代码时,唯一没有找到的是Windows.Storage.FileIO。 – Kevin

相关问题