<?xml version="1.0" encoding="utf-8"?>
<Application>
	<AppTitle>Local Storage</AppTitle>
	<AppShortName>LocStor</AppShortName>
	<Author>Gaev Keeka</Author>
	<Version>1.0</Version>
	<DesignDeviceName>Desktop</DesignDeviceName>
	<VariablesScanned>False</VariablesScanned>
	<PageWidth>800</PageWidth>
	<PageHeight>600</PageHeight>
	<AutoSizeWidth>False</AutoSizeWidth>
	<AutoSizeHeight>False</AutoSizeHeight>
	<HideScrollbars>False</HideScrollbars>
	<PublishPlatform>WebApp</PublishPlatform>
	<EmptyBuildFolder>False</EmptyBuildFolder>
	<LanguageCode>en</LanguageCode>
	<MobileOSTypes>[AndroidOS,iOS,WindowsPhoneOS]</MobileOSTypes>
	<WindowState>normal</WindowState>
	<TitleBar>True</TitleBar>
	<Sizeable>True</Sizeable>
	<MaximizeBtn>False</MaximizeBtn>
	<MinimizeBtn>True</MinimizeBtn>
	<SystemMenu>True</SystemMenu>
	<ContextMenu>False</ContextMenu>
	<AlwaysOnTop>False</AlwaysOnTop>
	<ShowInTaskbar>True</ShowInTaskbar>
	<SingleInstance>False</SingleInstance>
	<ChromeKioskMode>False</ChromeKioskMode>
	<startup>GetItem &quot;myParametersLocal&quot; [myParametersString]
...AlertBox &quot;myParametersString&quot; &quot;[myParametersString]&quot; &quot;&quot;
If [myParametersString] == null
   AlertBox &quot;Local Storage Item myParametersLocal NOT FOUND&quot; &quot;... populating myParams with default values&quot; &quot;&quot;
   ... create object with default values
   CreateEmptyObject [myParams]
   SetVar [myParams(&quot;FirstName&quot;)] &quot;Donald&quot;
   SetVar [myParams(&quot;LastName&quot;)] &quot;Duck&quot;
   SetVar [myParams(&quot;Age&quot;)] 101
   SetVar [myParams(&quot;Fruits&quot;)] &quot;Apple,Banana,Cherry,Dew Berry&quot;
Else
   AlertBox &quot;Local Storage Item myParametersLocal FOUND&quot; &quot;[myParametersString]&quot; &quot;&quot;
   ParseJSON &quot;[myParametersString]&quot; [myParams]
   ... verify
   ...SetVar [retrievedLastName] [myParams(&quot;LastName&quot;)]
   ...AlertBox &quot;retrieved LastName&quot; &quot;[retrievedLastName]&quot; &quot;&quot;
Endif</startup>
	<Components>
		<FunctionList name="Subroutines"/>
		<LibraryList name="Libraries"/>
		<PageList name="Main">
			<Components>
				<Page id="NewPage">
					<background_masterpage>MasterPage</background_masterpage>
					<Components>
						<PushButton id="ShowFirstName">
							<left>16px</left>
							<top>56px</top>
							<width>136px</width>
							<height>32px</height>
							<caption>Show First Name</caption>
							<click>SetVar [thisValue] &quot;[myParams(&apos;FirstName&apos;)&quot;
AlertBox &quot;First Name&quot; &quot;[thisValue]&quot; &quot;&quot;</click>
						</PushButton>
						<PushButton id="ShowLastName">
							<left>160px</left>
							<top>56px</top>
							<width>136px</width>
							<height>32px</height>
							<caption>Show Last Name</caption>
							<click>SetVar [thisValue] &quot;[myParams(&apos;LastName&apos;)&quot;
AlertBox &quot;Last Name&quot; &quot;[thisValue]&quot; &quot;&quot;</click>
						</PushButton>
						<PushButton id="ShowAge">
							<left>304px</left>
							<top>56px</top>
							<width>136px</width>
							<height>32px</height>
							<caption>Show Age</caption>
							<click>SetVar [thisValue] &quot;[myParams(&apos;Age&apos;)&quot;
AlertBox &quot;Age&quot; &quot;[thisValue]&quot; &quot;&quot;</click>
						</PushButton>
						<PushButton id="ShowFruits">
							<left>448px</left>
							<top>56px</top>
							<width>136px</width>
							<height>32px</height>
							<caption>Show Fruits</caption>
							<click>SetVar [thisValue] &quot;[myParams(&apos;Fruits&apos;)&quot;
AlertBox &quot;Fruits&quot; &quot;[thisValue]&quot; &quot;&quot;</click>
						</PushButton>
						<Listbox id="ParamNames">
							<left>16px</left>
							<top>112px</top>
							<width>128px</width>
							<height>80px</height>
							<items>FirstName,LastName,Age,Fruits</items>
							<variable>[currentItem]</variable>
							<multi_select>False</multi_select>
							<change>...AlertBox &quot;currentItem&quot; &quot;[currentItem]&quot; &quot;&quot;
SetVar [itemValue] [myParams([currentItem])]</change>
						</Listbox>
						<TextInput id="ItemValue">
							<left>160px</left>
							<top>112px</top>
							<width>424px</width>
							<height>32px</height>
							<variable>[itemValue]</variable>
						</TextInput>
						<PushButton id="SaveParameters">
							<left>16px</left>
							<top>200px</top>
							<width>136px</width>
							<height>32px</height>
							<caption>Save Parameters</caption>
							<click>... stringify [myParams]
StringifyJSON [myParams] [myParamsStringified]
AlertBox &quot;Stringified&quot; &quot;[myParamsStringified]&quot; &quot;&quot;
... save to local storage
SetItem &quot;myParametersLocal&quot; [myParamsStringified]

... verify
...GetItem &quot;myParametersLocal&quot; [gktemp]
...AlertBox &quot;gkTemp&quot; &quot;[gkTemp]&quot; &quot;&quot;</click>
						</PushButton>
						<PushButton id="ClearParameters">
							<left>160px</left>
							<top>200px</top>
							<width>136px</width>
							<height>32px</height>
							<caption>Clear Parameters</caption>
							<click>RemoveItem &quot;myParametersLocal&quot;
AlertBox &quot;Local Storage Itemm myParametersLocal&quot; &quot;... Removed&quot; &quot;&quot;</click>
						</PushButton>
						<PushButton id="UpdateItem">
							<left>592px</left>
							<top>112px</top>
							<width>136px</width>
							<height>32px</height>
							<caption>Update Item</caption>
							<click>SetVar [myParams([currentItem])] &quot;[itemValue]&quot;</click>
						</PushButton>
						<Container id="Container1">
							<left>16px</left>
							<top>240px</top>
							<width>768px</width>
							<height>344px</height>
							<style>background-color:#fff;border-style:solid;border-width:1px;padding-left:5px;padding-top:5px</style>
							<html>This sample App shows a suggested method for managing information items that need to be stored in &lt;strong&gt;Local Storage&lt;/strong&gt;.&lt;br/&gt;&lt;br/&gt;

1) All information to be saved between sessions is managed within a single JSON object (as key/value pairs).&lt;br/&gt;&lt;br/&gt;

2) When required to be saved ...&lt;br/&gt;
a) &lt;strong&gt;StringifyJSON&lt;/strong&gt; is used to convert this JSON object to a string variable.&lt;br/&gt;
b) &lt;strong&gt;SetItem&lt;/strong&gt; is then used to save the resulting string.&lt;br/&gt;&lt;br/&gt;

3) When required to be retrieved ...&lt;br/&gt;
a) &lt;strong&gt;GetItem&lt;/strong&gt; is used to retrieve the previously saved string.&lt;br/&gt;
b) &lt;strong&gt;ParseJSON&lt;/strong&gt; is then used to recreate the JSON object containing key/value pairs.&lt;br/&gt;&lt;br/&gt;

4) Note that ...&lt;br/&gt;
a) You can choose to group your information in multiple JSON objects (each stored as a separate Local Storage Item)&lt;br/&gt;
b) You can clear all information for a particular Local Storage Item using &lt;strong&gt;RemoveItem&lt;/strong&gt;.&lt;br/&gt;
c) The sample also shows how to update individual key/value pairs within a JSON object.</html>
						</Container>
					</Components>
				</Page>
			</Components>
		</PageList>
		<PageList name="Master">
			<Components>
				<Page id="MasterPage">
					<Components>
						<Headline id="Headline1">
							<left>16px</left>
							<top>8px</top>
							<width>768px</width>
							<height>40px</height>
							<text>Local Storage</text>
						</Headline>
					</Components>
				</Page>
			</Components>
		</PageList>
		<PageList name="Dialog">
			<Components>
				<Page id="NewDialog">
					<Components>
						<DialogContainer id="DialogContainer1">
							<left>0px</left>
							<top>0px</top>
							<width>800px</width>
							<height>600px</height>
							<close_button>False</close_button>
						</DialogContainer>
					</Components>
				</Page>
			</Components>
		</PageList>
	</Components>
</Application>
