public void Save()
{
var dic = new StringDictionary();
var settingsType = this.GetType();
// ------------------------------------------------------------
// Enumerate through settings properties
// ------------------------------------------------------------
foreach (var propertyInformation in settingsType.GetProperties())
{
if (propertyInformation.Name != "Instance")
{
// ------------------------------------------------------------
// Extract property value and its string representation
// ------------------------------------------------------------
var propertyValue = propertyInformation.GetValue(this, null);
string valueAsString;
// ------------------------------------------------------------
// Format null/default property values as empty strings
// ------------------------------------------------------------
if (propertyValue == null || propertyValue.Equals(Int32.MinValue) ||
propertyValue.Equals(Single.MinValue))
{
valueAsString = String.Empty;
}
else
{
valueAsString = propertyValue.ToString();
}
// ------------------------------------------------------------
// Write property name/value pair
// ------------------------------------------------------------
dic.Add(propertyInformation.Name, valueAsString);
}
}
BlogService.SaveSettings(dic);
_isRazorTheme = null;
OnChanged();
}