You can create a great user experience by reading from data storage when the application starts to configure the interface based on saved preferences or data. We'll learn how to read from roaming storage to read in data that has been saved and initialize the interface with that saved data.
- [Voiceover] We have written some data…to our roaming storage and now what we wanna do…is we wanna read it out and so let's go into default…and what we're gonna do right up top is…we are going to go in and we are going…to check for the storage in our roaming…right when the application starts.…So onactivated, let's go down here and right before we add…this nav EventListener let's just go check roaming data…and let's keep it nice and separate.…
And so we can define this function out here…and we can say check roaming data…and what we can do at this point is we can take a look…and try to read that text file so what we can say is…var promise is equal to…WinJS.Application.roaming….readText…and you'll see that when it's reading text it's asking…for the file name and we have listed ours as current…and it's asking for what do you wanna have come back…if it's not found and we're just gonna say undefined.…
Now, this does return a promise as this is asynchronous.…It's gotta go to the system, do some file I/O and come back.…
Watch to gain an understanding of the Universal Windows Platform and the application life cycle. Learn to create adaptive layouts with WinJS controls. Discover how to store and share data, capture a variety of input, and explore the unified Microsoft-specific APIs: Windows Core and Geolocation. Stacey Mulcahy, a Windows evangelist, provides developers with everything they need to start building Universal Windows apps and break into cross-device development.
- Setting up your development environment
- Coding in WinJS
- Creating page objects
- Animating page transitions
- Implementing responsive design principles and UI patterns
- Working with layout controls
- Using APIs: Windows Core and Geolocation
- Saving and reading data
Skill Level Beginner
1. Getting Started with Universal Windows Applications
3. Layouts and Controls
4. Utilizing APIs
5. Managing Data and Storage
Next steps1m 56s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.