void addClick(object sender, EventArgs e) { using (InputBox box = new InputBox()) { box.Label.Text = ResourceService.GetString("Dialog.HighlightingEditor.KeywordLists.EnterName"); if (box.ShowDialog() == DialogResult.Cancel) { return; } if (box.TextBox.Text == "") { return; } foreach (ListViewItem item in listView.Items) { if (item.Text == box.TextBox.Text) { return; } } KeywordListNode kwn = new KeywordListNode(box.TextBox.Text); ListViewItem lv = new ListViewItem(box.TextBox.Text); lv.Tag = kwn; parentNode.Nodes.Add(kwn); listView.Items.Add(lv); } }
public override void StoreSettings() { KeywordListNode node = (KeywordListNode)parentNode; StringCollection col = new StringCollection(); foreach (string word in listBox.Items) { col.Add(word); } node.Words = col; node.Name = nameBox.Text; node.HighlightColor = color; }
public KeywordListOptionPanel(KeywordListNode parent) : base(parent) { SetupFromXmlFile(System.IO.Path.Combine(PropertyService.DataDirectory, @"resources\panels\HighlightingEditor\KeywordList.xfrm")); addBtn = (Button)ControlDictionary["addBtn"]; addBtn.Click += new EventHandler(addBtnClick); removeBtn = (Button)ControlDictionary["removeBtn"]; removeBtn.Click += new EventHandler(removeBtnClick); chgBtn = (Button)ControlDictionary["chgBtn"]; chgBtn.Click += new EventHandler(chgBtnClick); nameBox = (TextBox)ControlDictionary["nameBox"]; sampleLabel = (Label)ControlDictionary["sampleLabel"]; listBox = (ListBox)ControlDictionary["listBox"]; }
public override void LoadSettings() { KeywordListNode node = (KeywordListNode)parentNode; listBox.Items.Clear(); foreach (string word in node.Words) { listBox.Items.Add(word); } IProperties properties = ((IProperties)PropertyService.GetProperty("NetFocus.DataStructure.TextEditor.Document.DefaultDocumentProperties", new DefaultProperties())); sampleLabel.Font = ParseFont(properties.GetProperty("DefaultFont", new Font("Courier New", 10).ToString())); color = node.HighlightColor; nameBox.Text = node.Name; PreviewUpdate(sampleLabel, color); }