jj 18.10 add ClassInactivity & ClassInactivityFilter
This commit is contained in:
45
app/DD-Record-Organizer/ClassInactivity.vb
Normal file
45
app/DD-Record-Organizer/ClassInactivity.vb
Normal file
@@ -0,0 +1,45 @@
|
||||
Public Class ClassInactivity
|
||||
Private _timer As Timers.Timer
|
||||
Private _interval As Integer
|
||||
|
||||
Public Sub New(intervalMinutes As Integer)
|
||||
_interval = intervalMinutes * 1000 * 60
|
||||
_timer = New Timers.Timer(_interval)
|
||||
_timer.AutoReset = False
|
||||
_timer.Enabled = True
|
||||
AddHandler _timer.Elapsed, AddressOf OnTick
|
||||
End Sub
|
||||
|
||||
Public Sub Start()
|
||||
If _interval > 0 Then
|
||||
_timer.Enabled = True
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub Reset()
|
||||
_timer.Enabled = False
|
||||
_timer.Enabled = True
|
||||
End Sub
|
||||
|
||||
Public Sub SetInterval(newInterval As Integer)
|
||||
_timer.Interval = newInterval
|
||||
_interval = newInterval
|
||||
End Sub
|
||||
|
||||
Private Sub OnTick()
|
||||
' Der User wird ausgeloggt
|
||||
ClassUser.LogoutUser()
|
||||
|
||||
Dim result As DialogResult = MessageBox.Show("Sie wurden aufgrund von Inaktivität ausgeloggt. Möchten Sie sich wieder anmelden?", "Inaktivität", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
If result = DialogResult.Yes Then
|
||||
ClassInit.InitUserLogin()
|
||||
MsgBox("Sie wurden wieder eingeloggt")
|
||||
Else
|
||||
MsgBox("Die Anwendung wird beendet")
|
||||
Application.Exit()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user