-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAddConditional.vb
60 lines (53 loc) · 2.22 KB
/
AddConditional.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Imports System.Windows.Forms
Public Class AddConditional
Public output = ""
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
If Empty.Checked Then
Value.Text = ""
End If
Dim ineq = ""
If Yesnt.Checked Then
ineq = "!"
End If
For Each line In Display.Lines
If Not output = "" Then
output &= vbNewLine
End If
output &= "[" & Attribute.Text & ineq & "=" & Value.Text & "]" & line.Replace(vbNewLine, "").Replace("\n", "") & "[/" & Attribute.Text & ineq & "=]"
Next
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
Private Sub Populate() Handles Attribute.SelectedIndexChanged, Attribute.TextChanged
For Each att As TreeNode In Main.AttributeTree.Nodes
If att.Text = Attribute.Text Then
Value.Items.Clear()
For Each val As TreeNode In att.Nodes
Value.Items.Add(val.Text)
Next
End If
Next
End Sub
Private Sub AddConditional_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each att As TreeNode In Main.AttributeTree.Nodes
Attribute.Items.Add(att.Text)
Next
Populate()
Display.WordWrap = My.Settings.WordWrap
Display.VirtualSpace = My.Settings.VirtualSpace
Display.WideCaret = My.Settings.WideCaret
Display.Font = My.Settings.editorFont
End Sub
Private Sub AddConditional_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Escape Then
Me.Close()
End If
End Sub
Private Sub Empty_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Empty.CheckedChanged
Value.Enabled = (Not Empty.Checked)
End Sub
End Class