In Asp.net development, there are many methods for passing values between pages, such as session and cookie. However, in Silverlight, we can implement this through the independent storage object isolatedstoragesettings.
(1) first, you need to add the namespace: using system. Io. isolatedstorage on each page that needs to use the passed value;
(2) On the login. XAML page, create an isolatedstorage object as follows:
// Use the independently stored isolatedstoragesettings object
Private isolatedstoragesetemediacettings = isolatedstoragesettings. applicationsettings;
(3) In the logon button event, add the following session-like statement after the statement that passes verification and jumps to save user information and read the value on other pages.
...
If (! Etettings. Contains ("uname "))
{
Deleetask. add ("uname", this. tbusername. Text. Trim ());
}
...
(4) On the mainpage. XAML page, create an isolatedstoragesettings object and use it to read the stored user information.
...
// Use the independently stored isolatedstoragesettings object
Private isolatedstoragesetemediacettings = isolatedstoragesettings. applicationsettings;
...
If (appsettings. Contains ("uname "))
{
This. tbusername. Text = maid ["uname"]. tostring ();
}