OBS: download the application please visit www.mrbool.com/player
Author: Ayad Boudiab
Title: Visual Studio C# - Silverlight - Isolated Storage - Lesson III
Duration: 15:50 min
Description: In this video we continue our discussion on isolated storage. In the previous video, we created the UI. Now, we implement the functionality in the code behind. The three main methods are: GetLastVisit(), SetLastVisit_Click(), and DeleteFile_Click(). When the user loads the page we check if the file exists in isolated storage using GetLastVisit(). If that file exists, we display the date and time the user last ran the application. When we click on the button "Set last visit", the current date and time will be written to "lastvisit.txt" in isolated storage. Now if you exit and come back, your last visit date and time will be displayed. The last method DeleteFile_Click() will delete "lastvisit.txt" from isolated storage. When you ran the application now, it is as if you are visiting for the first time.
Methodology: Good coding standard and simplified design.
Technologies: Silverlight 2.0
Examples constructed: This example implements the functionality for reading, writing and deleting from isolated storage. In the first method, we read the user's last visit date and time from the isolated storage. The second method sets the last visit's date and time in the isolated storage's lastvisit.txt file. The last method deletes the file from isolated storage.
Key words: Isolated storage, Row definition, Column definition, TextBlock, Button, Margin, IsolatedStorageFile, GetUserStoreForApplication, IsolatedStorageFileStream, StreamReader, StreamWriter, CreateFile, OpenFile, DeleteFile, AvailableFreeSpace, Quota, IncreaseQuotaTo.