Click or drag to resize
IConfigurationStorage Interface
The interface for objects that can load and save Configuration objects.

Namespace: VirtualRadar.Interface.Settings
Assembly: VirtualRadar.Interface (in VirtualRadar.Interface.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public interface IConfigurationStorage : ISingleton<IConfigurationStorage>

The IConfigurationStorage type exposes the following members.

Properties
  NameDescription
Public propertyFolder
Gets or sets the folder the contains the configuration and log files.
Public propertyProvider
Gets or sets a value that abstracts away the environment for testing purposes.
Public propertySingleton
Gets the single instance of the class that should be used throughout the application.
(Inherited from ISingletonT.)
Top
Methods
  NameDescription
Public methodErase
Deletes all of the configuration settings, resetting everything back to factory settings.
Public methodLoad
Loads the current configuration for the user.
Public methodSave
Saves the configuration for the user.
Top
Events
  NameDescription
Public eventConfigurationChanged
Raised after Save(Configuration) has saved a new configuration to disk or Erase has deleted the user's configuration.
Top
Examples
To read all of the application settings in one go:
IConfigurationStorage storage = Factory.Singleton.Resolve<IConfigurationStorage>().Singleton;
Configuration configuration = storage.Load();
To change a setting, save it and automatically raise ConfigurationChanged:
IConfigurationStorage storage = Factory.Singleton.Resolve<IConfigurationStorage>().Singleton;
Configuration configuration = storage.Load();
configuration.AudioSettings.Enabled = false;
storage.Save(configuration);
And to have an event handler that is raised whenever something changes the configuration:
private void SetupMyObject()
{
    IConfigurationStorage storage = Factory.Singleton.Resolve<IConfigurationStorage>().Singleton;
    storage.ConfigurationChanged += ConfigurationStorage_ConfigurationChanged;
}

private void ConfigurationStorage_ConfigurationChanged(object sender, EventArgs args)
{
    // reload and apply new configuration here
}
See Also