/**
         * Checks that does the settings have the specified value.
         */
        public bool HasValue(string settingValue)
        {
            ISettingEntry se = this.GetSettingByValue(settingValue);

            if (se != null)
            {
                return(true);
            }
            return(false);
        }
        /**
         * Checks that does the settings have the specified key.
         */
        public bool HasKey(string settingKey)
        {
            ISettingEntry se = this.GetSetting(settingKey);

            if (se != null)
            {
                return(true);
            }
            return(false);
        }
        /**
         * Changes the value of the specified setting. If its not found, adds it.
         */
        public void ChangeValue(string settingKey, string settingValue)
        {
            if (!this.HasKey(settingKey))
            {
                this.AddValue(settingKey, settingValue);
            }
            ISettingEntry se = this.GetSetting(settingKey);

            if (se != null)
            {
                se.Value = settingValue;
            }
        }
Esempio n. 4
0
        public void PopulateSnippetList()
        {
            this.snippetsComboBox.Items.Clear();
            this.snippetsComboBox.Items.Add("Select...");
            int count = this.snippets.Settings.Count;

            for (int i = 0; i < count; i++)
            {
                ISettingEntry se = (ISettingEntry)this.snippets.Settings[i];
                this.snippetsComboBox.Items.Add(se.Key);
            }
            this.snippetsComboBox.SelectedIndex = 0;
            this.snippetTextBox.Enabled         = false;
            this.deleteButton.Enabled           = false;
            this.saveButton.Enabled             = false;
        }
 /**
  * Gets the string value of the specified setting by key.
  */
 public string GetValue(string settingKey)
 {
     try
     {
         ISettingEntry se = this.GetSetting(settingKey);
         if (se != null)
         {
             return(se.Value);
         }
         return(null);
     }
     catch (Exception ex)
     {
         ErrorHandler.ShowError("Could not find the setting value.", ex);
         return(null);
     }
 }