Author: Rafe Wu
Channel 9 http://channel9.msdn.com/Blogs/OneCode/How-to-Port-iOS-apps-to-Windows-Store-apps
Windows 8 features a very comprehensive system of managing data for applications. This section compares the Application Preference features of Windows 8 and iOS.
The following table shows how we store application settings on the two platforms.
iOS
Windows Store Application
Application Preferences
System wide settings application
In-Application preference pages
In-Application settings charm
Preferred/Required
Preference UI
Declarative syntax for System wide Settings
Developer implements a page for in-app preferences
System provide an in-application settings charm.
Developer implements Settings Flyout
In iOS it is recommend to centralize the app preferences in system settings. There are some 3rd party libraries you can use to implement in-application settings. In Windows Store applications, the application settings are stored on per-application basis.
You can use ApplicationData.Current.LocalSettings property to save the preference locally. Or use RoamingSettings property so that other devices installed this app can also use these settings.
Generally you should load settings when the application is activated and store settings when the application exits. In Windows 8, you should fetch settings in OnLauched and Application.Resuming event handler, write data in Application.Suspending event handler.
Besides settings, Windows Store applications can create files and folders in the StorageFolder. They use StorageFolder and StorageFile classes for folder and file operations.
Windows 8 provides four different folders to store the private data:
Windows Store application doesn’t provide the general external storage due to security reason. You can access some known libraries, such as Documents, Videos, Music and Pictures folders. But you should declare the capabilities in the manifest file before accessing. You can also access SD storage through RemovableDevices property.
For security reason, the Windows Store application can’t access arbitrary files in the device implicitly. If you do want to access a specified file, you should use file picker to select this file explicitly. Then the application gets the permission to access this file.
In this chapter, we compared data storage guidelines for Windows 8 and iOS. We also looked at the storage apis in Windows 8.
See also Porting iOS Apps to Windows 8 (4): Application Lifecycle Differences