Posts

Showing posts with the label Local Storage

UWP: Storing and retrieving composite application data

Image
You can store and retrieve composite application data in a UWP project using the Windows Storage. Specifically you will be using the Windows.Storage.ApplicationDataCompositeValue sealed class shown in the Object Browser. ObjBrowser.png In this post a project is described where in a pair of values are stored in the Windows Storage's local folder and retrieved. The values are stored using a button click event of a button and retrieved into text boxes in the click event of a second button. The MainPage.xaml for the project is as shown. MainPageXaml.png The code for storing and retrieving is shown in the MainPageXAMLCs. You first define the local settingss using the Windows.Storage.ApplicationDataContainer and the local folder . The composite values are set to the local settings. The retrieving is by extracting the values in the local settings and reading it into a text box. The result of running the application is shown here. The code can be simplified as...

Storing an array locally using browser's Local Storage

Image
My previous post showed how to store a single piece of information in Local Storage (Browser Storage). However instead of a single piece of data you want to store an array of items. Let us say your array has three elements, rose, jasmine and hyacinth and you want to store in an array named 'flowers'. The following page shows how you may store array and retrieve array elements using JavaScript. Each statement is commented (view image magnified, if necessary). ArrayStoreLocalStorage.png Place this page in IIS's wwwroot folder and browse. You can see the elements in the array in LocalStorage . ArrayStoreLocalStorage1.png You can see more clearly here in the Microsoft Edge's developer window. Data stored from the previous post is also seen. ArrayStoreLocalStorage2.png

Storing data locally using Local Storage

Image
Local Storage is supported if you use HTML. First of all you should make sure that your browser supports Local Storage. Data is stored as NAME,VALUE pairs in local storage. You can review this post  Local Storage is an alternative to storing data in Cookies. The data is stored in the browser and more data can be stored in Local Storage than cookies. Local Storage is supported if you use HTML. First of all you should make sure that your browser supports Local Storage. Data is stored as NAME,VALUE pairs in local storage. You can review this post http://hodentekhelp.blogspot.com/2017/08/does-your-browser-support-localstorage.html Let us say you want to store the string "Hi, Good Morning". You need to create a NAME VALUE pair, your VALUE being "Hi, Good morning" and the NAME can be anything. In the present example the NAME is "Greetings". NAME="Greetings" VALUE="Hi, Good Morning" All you need to do is create a web page (j...