Public Class frmWaehrung

#Region "Ereignisse"
    Private Sub frmWaehrung_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim blLogik As New BL

        Dim lstKurse As List(Of Kurs)
        lstKurse = blLogik.HoleSortenListe()

        cbxSorte.DataSource = lstKurse
    End Sub

    Private Sub Berechnen(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtEingabe.TextChanged, cbxSorte.SelectedIndexChanged, radDM.CheckedChanged
        Dim ksKurs As Kurs
        ksKurs = cbxSorte.SelectedItem

        If IsNumeric(txtEingabe.Text) Then
            txtAusgabe.Text = Format(CDbl(txtEingabe.Text) / ksKurs.Kurs _
                                     * IIf(radDM.Checked, 1.95583, 1), "#,##0.00")
        End If
    End Sub

    Private Sub butEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butEdit.Click
        Dim ksKurs As Kurs
        ksKurs = cbxSorte.SelectedItem

        Dim dlgKursEditor As frmKursEdit
        dlgKursEditor = New frmKursEdit()
        With dlgKursEditor
            .Sortenzeichen = ksKurs.Sortenzeichen
            .Land = ksKurs.Land
            .Kurs = ksKurs.Kurs
        End With

        If dlgKursEditor.ShowDialog() = Windows.Forms.DialogResult.OK Then
            With ksKurs
                .Kurs = dlgKursEditor.Kurs
                .Sortenzeichen = dlgKursEditor.Sortenzeichen
                .Land = dlgKursEditor.Land
            End With
            ksKurs.Save()
        End If

        'Dim dlgKursEditor As frmBindingKursEdit
        'dlgKursEditor = New frmBindingKursEdit(ksKurs)

        'If dlgKursEditor.ShowDialog() = Windows.Forms.DialogResult.OK Then
        '    ksKurs.Save()
        'End If

    End Sub

    Private Sub butNeu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butNeu.Click
        Dim ksKurs As Kurs
        ksKurs = New Kurs

        Dim dlgKursEditor As frmKursEdit
        dlgKursEditor = New frmKursEdit()

        If dlgKursEditor.ShowDialog() = Windows.Forms.DialogResult.OK Then
            With ksKurs
                .Kurs = dlgKursEditor.Kurs
                .Sortenzeichen = dlgKursEditor.Sortenzeichen
                .Land = dlgKursEditor.Land
            End With
            ksKurs.Save()
        End If

        'Dim dlgKursEditor As frmBindingKursEdit
        'dlgKursEditor = New frmBindingKursEdit(ksKurs)

        'If dlgKursEditor.ShowDialog() = Windows.Forms.DialogResult.OK Then
        '    ksKurs.Save()
        'End If

    End Sub
#End Region

End Class
