PageRenderTime 24ms CodeModel.GetById 12ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/Source Code/PowerSong/Item Management/frmTitle.vb

#
Visual Basic | 61 lines | 46 code | 15 blank | 0 comment | 0 complexity | b65636372173be8c7a1e0d4d81d6b886 MD5 | raw file
 1Imports System.Windows.Forms
 2Imports PowerSong.SongDatabase
 3Imports PowerSong.SongDatabase.Items
 4
 5Public Class frmTitle
 6
 7    Private FTitle As New AdhocItem
 8
 9    Public ReadOnly Property Title() As AdhocItem
10        Get
11            UpdateTitle()
12            Return FTitle
13        End Get
14    End Property
15
16    Private Enum EMode
17        Add
18        Edit
19    End Enum
20
21    Private FMode As EMode
22
23    Public Sub New()
24        InitializeComponent()
25        FMode = EMode.Add
26        Text = "Add Title"
27    End Sub
28
29    Public Sub New(ByVal existingTitle As AdhocItem)
30
31        InitializeComponent()
32
33        FMode = EMode.Edit
34        FTitle = existingTitle
35        txtTitle.Text = FTitle.Title
36        txtContents.Text = FTitle.CombineIntoString
37        Text = "Edit Title"
38
39    End Sub
40
41    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
42        Me.DialogResult = System.Windows.Forms.DialogResult.OK
43        Me.Close()
44    End Sub
45
46    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
47        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
48        Me.Close()
49    End Sub
50
51    Private Sub UpdateTitle()
52        FTitle.Title = txtTitle.Text
53        FTitle.Parts = BaseItem.SplitIntoParts(txtContents.Lines)
54    End Sub
55
56    Private Sub frmTitle_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
57        txtTitle.SelectAll()
58        txtTitle.Focus()
59    End Sub
60
61End Class