private void listBoxKeywords_SelectedIndexChanged(object sender, EventArgs e) { KeywordInfo selectedItem = this._listBoxKeywords.SelectedItem as KeywordInfo; if (selectedItem != null) { this._labelDescription.Text = selectedItem.Description.Replace(@"\n", "\n"); this._groupBoxFormat.Enabled = selectedItem.SupportsFormatting; this._labelYValue.Enabled = selectedItem.SupportsValueIndex; this._numericUpDownYValue.Enabled = selectedItem.SupportsValueIndex && (this._maxYValueIndex > 0); this._labelYValue.Enabled = selectedItem.SupportsValueIndex && (this._maxYValueIndex > 0); } }
private void buttonOk_Click(object sender, EventArgs e) { this.Keyword = string.Empty; KeywordInfo selectedItem = this._listBoxKeywords.SelectedItem as KeywordInfo; if (selectedItem != null) { this.Keyword = selectedItem.Keyword; if (selectedItem.SupportsValueIndex && (((int)this._numericUpDownYValue.Value) > 0)) { this.Keyword = this.Keyword + "Y" + ((int)this._numericUpDownYValue.Value).ToString(CultureInfo.InvariantCulture); } if ((selectedItem.SupportsFormatting && (this._comboBoxFormat.SelectedIndex > 0)) && (this.GetFormatString().Length > 0)) { this.Keyword = this.Keyword + "{" + this.GetFormatString() + "}"; } } }
public void Register(string name, string keyword, string keywordAliases, string description, string appliesToTypes, string appliesToProperties, bool supportsFormatting, bool supportsValueIndex) { KeywordInfo info = new KeywordInfo(name, keyword, keywordAliases, description, appliesToTypes, appliesToProperties, supportsFormatting, supportsValueIndex); this.registeredKeywords.Add(info); }