- Back to Home »
- Windows store apps C#/XAML »
- Windows store apps development c# xaml Part 5 - Handling files with example code
Posted by :
Sudhir Chekuri
Monday, 30 September 2013
Windows store apps are sandboxed apps. You have some limitations to access files and hardware. You cannot directly access files you have to access them through broker. WinRT has to allow the app to access files. It can be done asynchronously only. Any operation that takes more than 15 milliseconds to complete has to be asynchronous operation in windows store apps. Asynchronous operations will work in the background without affecting user experience.
System.IO.Files is no more in WinRT also namespaces used to interact with registry are no available in WinRT.
Windows.Storage is the namespace you have to use to work with files here.
Picker is used to access document library, skydrive or homegroup.
Windows.Storage.StorageFolder - Copy, Move, Rename, Delete
Windows.Storage.StorageFile - Copy, Move, Rename, Delete
Windows.Storage.FileIO - Read, Write, Append methods
Windows.Storage.Pickers - Folder, save/open file, Third Party to save data in skydrive.
Capabilities and strategies:
App Storage is where app is installed. They will deployed in this location and it is read only.
Syntax: ms-appx://folder/file
Local Storage is like isolated storage.
Local folder is where you can store images, database and other files in local folder.
Syntax: ms-appdata://local/folder/file
Roaming folder data can be roamed and can be accessed from anywhere.
Syntax: ms-appdata://roaming/folder/file
System.IO.Files is no more in WinRT also namespaces used to interact with registry are no available in WinRT.
Windows.Storage is the namespace you have to use to work with files here.
Picker is used to access document library, skydrive or homegroup.
Windows.Storage.StorageFolder - Copy, Move, Rename, Delete
Windows.Storage.StorageFile - Copy, Move, Rename, Delete
Windows.Storage.FileIO - Read, Write, Append methods
Windows.Storage.Pickers - Folder, save/open file, Third Party to save data in skydrive.
Capabilities and strategies:
App Storage is where app is installed. They will deployed in this location and it is read only.
Syntax: ms-appx://folder/file
Local Storage is like isolated storage.
Local folder is where you can store images, database and other files in local folder.
Syntax: ms-appdata://local/folder/file
Roaming folder data can be roamed and can be accessed from anywhere.
Syntax: ms-appdata://roaming/folder/file