0
我试图从Web服务中取回信息,然后在整个项目中使用该信息,但无法弄清楚如何从Web服务查询设置公共字符串。目前,我已将硬编码到公共字符串中。如何将硬编码值替换为查询返回的值?WP7从Web服务查询设置公共字符串值
public MainPage()
{
WebClient id = new WebClient();
id.Credentials = new NetworkCredential(UsernameSetting, PasswordSetting);
id.DownloadStringCompleted += new DownloadStringCompletedEventHandler(id_DownloadStringCompleted);
id.DownloadStringAsync(new Uri("https://web-service-address/"));
}
void id_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error != null)
return;
XDocument xDocument = XDocument.Parse(e.Result);
var myid = xDocument.Descendants("service").First();
}
public string IDSetting = "1234567";