zoukankan      html  css  js  c++  java
  • metro 下载xml文件 GIS

    public class downClass1
    {
    public IStorageFile pResultStorageFile;
    public async Task<IStorageFile> down()
    {
    string CountriesFile = "fruit.xml";
    StorageFolder InstallationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
    StorageFile file = await InstallationFolder.CreateFileAsync(CountriesFile);//下载到本地
    BackgroundDownloader ppp = new BackgroundDownloader();
    DownloadOperation pDownloadOperation = ppp.CreateDownload(new Uri("https://files.cnblogs.com/gisbeginner/fruit.xml"), file);
    await pDownloadOperation.StartAsync();
    pResultStorageFile = pDownloadOperation.ResultFile;
    return pResultStorageFile;
    }
    }

    获得一个pResultStorageFile 文件引用

    downClass1 pdownClass1 = new downClass1();
    pDownLoadFile = pdownClass1.down() ;
    pDownLoadFile1 = await pDownLoadFile;

     //获得流

    Stream Countries = await pDownLoadFile1.OpenStreamForReadAsync();

    //利用流 解析xml 

    XDocument xDOC = XDocument.Load(Countries);
    var query = from a in xDOC.Elements("kinds").Elements("kind").Elements(transferValue)
    select a.Value;
    foreach (var C in query)
    {
    string CC = C;
    }
    itemListView.ItemsSource = query;

  • 相关阅读:
    Bzoj1101 [POI2007]Zap
    Bzoj2393 Cirno的完美算数教室
    UVa10891 Game of Sum
    Bzoj4128 Matrix
    类的组合
    继承
    属性查找与绑定方法
    类与对象
    面向对象程序设计——基础概念
    修改个人信息的程序
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2689100.html
Copyright © 2011-2022 走看看