Files
AVISO/Aviso/frmNotify.vb
2022-03-21 09:19:52 +01:00

119 lines
3.9 KiB
VB.net

Public Class frmNotify
Public Y As Integer = 0
Public AvisoID As Integer = 0
Public TimerInterval = 5000
Public Notify_ART As cNotify_ART
Enum cNotify_ART
AVISO_2H
NEUER_CHAT
End Enum
Protected Overrides ReadOnly Property ShowWithoutActivation() As Boolean
Get
Return True
End Get
End Property
Sub New(title As String, text As String)
Me.InitializeComponent()
Me.lblTitle.Text = title
Me.lblText.Text = text
End Sub
Sub New(art As cNotify_ART, typ As Integer, text As String, Optional id As Integer = -1)
Me.InitializeComponent()
Me.Notify_ART = art
Select Case Notify_ART
Case cNotify_ART.AVISO_2H
Me.AvisoID = id
Select Case typ
Case 1
Me.lblTitle.Text = "LKW Standzeit Benachrichtigung"
Me.lblText.Text = "Der LKW '" & text & "' ist vor über 2 Stunden eingetroffen."
Case 2
Me.lblTitle.Text = "LKW Standzeit - Vermerk eintragen"
Me.lblText.Text = "Der LKW '" & text & "' ist vor über 2 Stunden eingetroffen." &
"Bitte VERMERK eintragen!"
Case 3
Me.lblTitle.Text = "LKW Standzeit Benachrichtigung"
Me.lblText.Text = "Der LKW '" & text & "' steht bereits über 24 Stunden!"
Me.Header.BackColor = Color.Red
End Select
Case cNotify_ART.NEUER_CHAT
Me.lblTitle.Text = "AVISO-CHAT"
Me.lblText.Text = text
End Select
End Sub
Private Sub Timer_Tick(sender As Object, e As EventArgs) Handles Timer.Tick
frmHauptfenster.BringToFront()
End Sub
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
frmHauptfenster.BringToFront()
Me.Close()
End Sub
Private Sub frmNotify_Load(sender As Object, e As EventArgs) Handles Me.Load
Timer.Interval = TimerInterval
lblText.Cursor = IIf(AvisoID > 0, Cursors.Hand, Cursors.Default)
'If Y = 0 Then
'Me.Location = New Point(Me.Owner.Width - Me.Width - 10, Me.Owner.Height - Me.Height - 10)
' Else
' Me.Location = New Point(Me.Owner.Width - Me.Width - 10, Y)
' End If
Dim WIDTH = Screen.FromRectangle(Me.Bounds).WorkingArea.Size.Width
Dim hEIGHT = Screen.FromRectangle(Me.Bounds).WorkingArea.Size.Width
'RECHTS UNTEN:
'If Y = 0 Then
' Me.Location = New Point(WIDTH - Me.Width - 10, hEIGHT - Me.Height - 10)
'Else
' Me.Location = New Point(WIDTH - Me.Width - 10, Y)
'End If
If Y = 0 Then
Me.Location = New Point(10, hEIGHT - Me.Height - 10)
Else
Me.Location = New Point(10, Y)
End If
End Sub
Private Sub lblText_Click(sender As Object, e As EventArgs) Handles lblText.Click, lblTitle.Click, Header.Click
Select Case Notify_ART
Case cNotify_ART.AVISO_2H
frmHauptfenster.Details_anzeigen(AvisoID)
Me.Close()
Case cNotify_ART.NEUER_CHAT
For Each openForm In Application.OpenForms()
If TypeOf (openForm) Is VERAG_PROG_ALLGEMEIN.frmMessenger Then
CType(openForm, VERAG_PROG_ALLGEMEIN.frmMessenger).WindowState = FormWindowState.Normal
CType(openForm, VERAG_PROG_ALLGEMEIN.frmMessenger).BringToFront()
Me.Close()
Exit Sub
End If
Next
Dim f As New VERAG_PROG_ALLGEMEIN.frmMessenger
f.Location = Cursor.Position
f.Show()
Me.Close()
End Select
End Sub
End Class