You are on page 1of 10

M4: Files and Storage in

Windows Phone 8

Target Agenda | Day 1


Module and Topic | 10-minute breaks after each session / 60-minute meal break

Planned
Duration

1a - Introducing Windows Phone 8 Application Development | Part 1

50:00

1b - Introducing Windows Phone 8 Application Development | Part 2

50:00

2 - Designing Windows Phone Apps

50:00

3 - Building Windows Phone Apps

50:00

4 - Files and Storage on Windows Phone 8

50:00

Meal Break | 60-minutes

60:00

5 - Windows Phone 8 Application Lifecycle

50:00

6 - Background Agents

25:00

7 - Tiles and Lock Screen Notifications

25:00

8 - Push Notifications

30:00

9 - Using Phone Resources on Windows Phone 8

50:00

Target Agenda | Day 2


Module and Topic | 10-minute breaks after each session / 60-minute meal break

Planned
Duration

10 - App to App Communication

35:00

11 - Network Communication on Windows Phone 8

50:00

12 - Proximity Sensors and Bluetooth

35:00

13 - Speech Input on Windows Phone 8

35:00

14 - Maps and Location on Windows Phone 8

35:00

15 - Wallet Support

25:00

16 - In App Purchasing

25:00

Meal Break | 60-minutes

60:00

17 - The Windows Phone Store

50:00

18 - Enterprise Applications in Windows Phone 8: Architecture and Publishing

50:00

19 - Windows 8 and Windows Phone 8 Cross Platform Development

50:00

20 Mobile Web

50:00

Module Agenda

WP7.1IsolatedStorage and IsolatedStorageSettings APIs


Local Storage and Isolated Storage
Windows.Storage (Windows Phone Runtime) programming

Special Folders
Shared/Media
Shared/ShellContent

Shared/Transfers
Exploring the local folder with ISET
Using Removable SD cards

Not Covered in this Module


Local Database

No change from WP 7.1


See these Jump Start modules:
http://channel9.msdn.com/Series/Mango-Jump-Start/Mango-Jump-Start-08aApplication-Data-Storage-on-Windows-Phone--Part-1
http://channel9.msdn.com/Series/Mango-Jump-Start/Mango-Jump-Start-08bApplication-Data-Storage-on-Windows-Phone-Part-2
SQLite database (native only)

Persistent Storage in
Windows Phone 8

Local Data Storage: Overview


Installation
Folder

Package Manager installs


all app files into the
Installation Folder
Read-only access from app
Read-only reference
database

WP7.1: App Data


Install

Package
Manager
DB

Apps store data in


Local Folder
Settings and properties in
the app dictionary
Unstructured data in
Isolated Storage files
Structured data in
database files

Database
File (r/o)

App
WP8 Storage
APIs or
WP7 Isolated
Storage APIs

Application
Settings File

DB
Database file

Application
Files

Different Methods For Addressing Storage Locations


File Type/ API

Installation
Folder

Local Folder

Example

Local Database data


context

appdata:/

isostore:/

MyDataContext db = new MyDataContext


("isostore:/mydb.sdf")

Files access using


WP7.1 Isolated
Storage API

not supported

StorageFile and
StorageFolder
APIs

var isf =
IsolatedStorageFile.GetUserStoreForApplication()

File access using


Windows.Storage
API via URIs

ms-appx:///

msappdata:///local/

var file = await


Windows.StorageFile.GetFileFromApplicationUriAsync(
new Uri("ms-appdata:///local/AppConfigSettings.xml"));

File access using


Windows.Storage API
via StorageFolder
references

Windows.
ApplicationModel.
Package.Current.
InstalledLocation

Windows.Storage.
ApplicationData.
Current.
LocalFolder

var localFolder =
Windows.Storage.ApplicationData.Current.LocalFolder;
Windows.Storage.StorageFile storageFile =
await localFolder.GetFileAsync("CaptainsLog.store");

WP8 File Access Alternatives


Three ways of getting a reference to the same file:
// WP7.1 IsolatedStorage APIs
var isf = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream fs = new IsolatedStorageFileStream("CaptainsLog.store", FileMode.Open, isf));
...

// WP8 Storage APIs using URI


StorageFile storageFile = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(
new Uri("ms-appdata:///local/CaptainsLog.store "));
...

// WP8 Storage APIs


Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
Windows.Storage.StorageFile storageFile = await localFolder.GetFileAsync("CaptainsLog.store");
...

Storing Data using WP7.1


Isolated Storage APIs

You might also like