private void SavePostsOrPagesSettings()
 {
     // get post data/context to save
     using (SettingsPersisterHelper postSourceSettings = _recentPostsSettings.GetSubSettings(listBoxPostSources.SelectedPostSource.UniqueId))
     {
         if (listBoxPostSources.SelectedPostSource.SupportsPages)
         {
             postSourceSettings.SetBoolean(SHOW_PAGES, radioButtonPages.Checked);
         }
         else
         {
             postSourceSettings.SetBoolean(SHOW_PAGES, false);
         }
     }
 }
        static WebProxySettings()
        {
            _settingsKey = ApplicationEnvironment.PreferencesSettingsRoot.GetSubSettings("WebProxy");
            if (ApplicationDiagnostics.ProxySettingsOverride != null)
            {
                Match m = Regex.Match(ApplicationDiagnostics.ProxySettingsOverride,
                                      @"^ ( (?<username>[^@:]+) : (?<password>[^@:]+) @)? (?<host>[^@:]+) (:(?<port>\d*))? $",
                                      RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture);
                if (m.Success)
                {
                    string username = m.Groups["username"].Value;
                    string password = m.Groups["password"].Value;
                    string host     = m.Groups["host"].Value;
                    string port     = m.Groups["port"].Value;

                    _readSettingsKey = new SettingsPersisterHelper(new MemorySettingsPersister());

                    _readSettingsKey.SetBoolean("Enabled", true);

                    if (!string.IsNullOrEmpty(username))
                    {
                        _readSettingsKey.SetString("Username", username);
                    }
                    if (!string.IsNullOrEmpty(password))
                    {
                        _readSettingsKey.SetEncryptedString("Password", password);
                    }

                    _readSettingsKey.SetString("Hostname", host);

                    if (!string.IsNullOrEmpty(port))
                    {
                        _readSettingsKey.SetInt32("Port", int.Parse(port, CultureInfo.InvariantCulture));
                    }
                }
            }

            if (_readSettingsKey == null)
            {
                _readSettingsKey = _settingsKey;
            }
        }