Intersoft ClientUI Documentation
How-to: Save and Load an Application-specific Settings

The following examples show how to save a custom data to the isolated storage attached to your application, and retrieve the data using API.

Example

Description

ClientUI Application Framework features built-in integration with Isolated Storage allowing you to achieve data management tasks easily using API. By default, the application framework uses Site storage scope. You can use Application storage scope by setting the shell's InstallStorageScope property to Application. For more information about isolated storage, see Isolated Storage (MSDN Library).

In addition, you can also save and retrieve custom settings that you may want to attach on a particular application. Instead of writing a dozen lines of code to work with isolated settings, you can simply use SaveSetting and GetSetting method provided by the application package.

Code

The following code example shows how to save the value of a text box to the isolated storage through the application framework's API.

C#
Copy Code
private void SaveSettingButton_Click(object sender, RoutedEventArgs e)
{
    UXShell.Current.RootApplication.SaveSetting("Settings", txtSettings.Text);
}

The following code example shows how to load the value that were previously saved such as described in the previous example.

C#
Copy Code
string value = UXShell.Current.RootApplication.GetSetting("Settings").ToString();

if (!string.IsNullOrEmpty(value))
    MessageBox.Show(value);
See Also

Concepts

Other Resources