Public Class frmSSOUserWarning
'Declare the starttime variable as a date
Private starttime As Date
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Set the start time to Date.now value
starttime = Date.Now
'Set the Username textbox to the environment variable of the usrname
txtUsername.Text = Environment.GetEnvironmentVariable("USERNAME")
End Sub
Private Sub Form1_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Move
'Prevents form from being moved
MyBase.Location = New System.Drawing.Point(30, 30)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'Declare the countdown variable
Dim countdown As New TimeSpan(0, 3, 0)
'Set the countdown to start from 3 minutes and go to 0.
'Displays the countdown in the countdown text box.
'When it hits zero it runs tsdiscon.exe and closes the program.
countdown = countdown.Subtract(Date.Now.Subtract(starttime))
txtCountdown.Text = String.Format("{0}:{1:00}", countdown.Minutes, countdown.Seconds)
If countdown.TotalSeconds <= 0 Then
Timer1.Enabled = False
Process.Start("C:\windows\system32\tsdiscon.exe")
Close()
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnContinue.Click
Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisconnect.Click
Process.Start("C:\windows\system32\tsdiscon.exe")
Close()
End Sub
Private Sub txtUsername_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUsername.TextChanged
End Sub
End Class