/Source Code/PowerSong/Item Management/frmConfigureItem.vb
Visual Basic | 66 lines | 49 code | 16 blank | 1 comment | 0 complexity | cc8d284cf60e0fe9f58d088e52e28ba6 MD5 | raw file
- Imports PowerSong.SongDatabase
- Imports PowerSong.SongDatabase.Items
-
- Public Class frmConfigureItem
-
- Private FItem As BaseItem = Nothing
- Private FStyles As Styles = Nothing
- Private FSelectedStyle As Style = Nothing
-
- Public Sub New(ByVal item As BaseItem, _
- ByVal itemStyle As Style, _
- ByVal styles As Styles)
-
- InitializeComponent()
- FItem = item
- FSelectedStyle = itemStyle
- FStyles = styles
- UpdateStyleList()
- Functionality.ConfigureForm(Me)
-
- End Sub
-
- Public ReadOnly Property SelectedStyle() As Style
- Get
- Return FSelectedStyle
- End Get
- End Property
-
- 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 OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
-
- ' Close the form
- Me.DialogResult = System.Windows.Forms.DialogResult.OK
- Me.Close()
-
- End Sub
-
- Private Sub btnConfigureStyles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConfigureStyles.Click
- If (New frmConfigureStyles(FStyles)).ShowDialog = Windows.Forms.DialogResult.OK Then
- UpdateStyleList()
- End If
- End Sub
-
- Private Sub UpdateStyleList()
- lstStyles.Items.Clear()
- For Each Style As Style In FStyles.GetAllStyles
- Dim Item As New ListItem(Of Guid)(Style.Name, Style.StyleID)
- lstStyles.Items.Add(Item)
- If Style Is FSelectedStyle Then lstStyles.SelectedItem = Item
- Next
- End Sub
-
- Private Sub lstStyles_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstStyles.SelectedIndexChanged
-
- If lstStyles.SelectedItem IsNot Nothing Then
- Dim SelectedItem As ListItem(Of Guid) = lstStyles.SelectedItem
- FSelectedStyle = FStyles.GetStyle(SelectedItem.Key)
- End If
-
- End Sub
-
- End Class