File Access in the Windows Phone 8 installation package and in the independent storage area

Source: Internet
Author: User

Files in the installation package:

Windows Phone 8 can directly access the files in the installation package in the form of a relative path, "apps/readme.txt ". For example, filestream stream = file. openread ("apps/readme.txt"); you can also use the following method:

String installpath = windows. ApplicationModel. Package. Current. installedlocation. Path ;;
String Path = path. Combine (installpath, "apps/readme.txt ");
Filestream stream = file. openread (PATH );

The navigate method of webbrowser can only use the "apps/readme.txt" format, for example:

Webbrowser browser = new webbrowser ();

Uri url = new uri ("html/index.html", urikind. Relative );

Browser. navigate (URI );

 

Files in the independent storage zone:

For access to the independent storage area, you must use isolatedstoragefile mystore = isolatedstoragefile. getuserstoreforapplication (); or use string localpath = applicationdata. Current. localfolder. Path; you cannot directly use the relative path.

However, for the webbrowserr navigate method to access files in the independent storage area, you can only use the relative path:

Webbrowser browser = new webbrowser ();

Uri url = new uri ("html/index.html", urikind. Relative );

Browser. navigate (URI );

That is to say, the relative path must be used to access the installation package and the independent storage zone of webbrowser.

In this way, when the installation package and the independent storage area have the same file path, webbrowser will first access the files in the independent storage area.

 

Microsoft is so cool !! One word: "Chaos", I'm going crazy.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.