Imports BusinessCommon

Imports BusinessWindows.LoginReference

Public Class Login

    Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
        Dim information As LoginInformation = (New LoginService).GetTicket(txtUserId.Text, txtPassword.Text, Environment.MachineName)
        If Not (information.Name Is Nothing) Then
            Dim ticket As AuthenticationTicket = New AuthenticationTicket(information.Name, information.IssueDate, information.Expiration, information.Roles, information.UserData)
            Dim identity As MyIdentity = New MyIdentity(ticket)
            My.User.CurrentPrincipal = New MyPrincipal(identity)
            MessageBox.Show("認証されました")
        Else
            MessageBox.Show("認証に失敗しました")
        End If
    End Sub
End Class
