Class MainWindow 
  ' Command: OrdenMostrarNota
  Private Shared alumno As New Alumno()
  Private Shared asignatura As New Asignatura()
  Public Shared ordenMostrarNota As New OrdenMostrarNota(alumno, asignatura, 111, 999)

  Public Sub New()
    InitializeComponent()
    ' Iniciar contextos de datos
    ctDni.DataContext = alumno
    lsdAsigs.DataContext = asignatura
    tbNota.DataContext = asignatura
  End Sub

  Private Sub ctDni_TextChanged(sender As Object, e As System.Windows.Controls.TextChangedEventArgs)
    lsdAsigs.ItemsSource = Nothing
    alumno.ListaAsignaturas.Clear()
    asignatura.Nota = -1.0F
    Dim id As Integer
    If Not Integer.TryParse(ctDni.Text, id) Then
      Return
    End If
    Dim listaAsigs As List(Of Asignatura) = bbdd.ObtenerAsigsAlumno(id)
    If listaAsigs Is Nothing Then
      tbError.Text = "Error: el DNI no existe."
      Return
    End If
    tbError.Text = "DNI válido."
    lsdAsigs.ItemsSource = listaAsigs
    alumno.ListaAsignaturas = listaAsigs
  End Sub
End Class
