795 lines
33 KiB
VB.net
795 lines
33 KiB
VB.net
Imports System.IO
|
|
Imports VERAG_PROG_ALLGEMEIN
|
|
Imports VERAG_PROG_ALLGEMEIN.cMeineFunktionenAVISO
|
|
|
|
|
|
|
|
Imports System.Data.OleDb
|
|
Imports System.Data.SqlClient
|
|
Imports AvisoTV.cUserSettings
|
|
|
|
|
|
Public Class frmAnzeige
|
|
Dim cptmp As Point
|
|
Dim displayZeilen As Boolean = False
|
|
Private AvisoDAL As New cAvisoDAL
|
|
Private VermerkeDAL As New cVermerkeDAL
|
|
Private locZeilen As Integer = -1
|
|
Private Anzahl As Integer
|
|
Private Grid_aktiv As Boolean = False
|
|
Private Zähler As Long = 0
|
|
Private hMerkZeit As Date
|
|
Private Max_Zeilen As Integer = 8 'maximale Zeilenanzeige pro Seite
|
|
Private ZeilenStandard As Integer = 8
|
|
Private Max_Seiten As Integer = 1 'maximale Zeilenanzeige pro Seite
|
|
Private Aktive_Seite As Integer = 0 'Merker, welche Seite gerade angezeigt wird
|
|
Private Merk_Ankunftsdatum As Date 'Merker Datum des zuletzt angezeigten LKWs (wegen Umblättern)
|
|
Private Anzahl_alle As Integer = 0
|
|
Private Standort As String = "" 'ev. Einschränkung auf Standort
|
|
|
|
Private StandortATILLA As Boolean = False
|
|
Private StandortSUB12 As Boolean = False
|
|
Private ZeilenATILLA As Integer = 16
|
|
|
|
Private Font1 As New Font(FontFamily.GenericSansSerif, 70, FontStyle.Bold)
|
|
Private Font1_MESS As New Font(FontFamily.GenericSansSerif, 40, FontStyle.Bold)
|
|
|
|
Private Font2 As New Font(FontFamily.GenericSansSerif, 70, FontStyle.Bold)
|
|
Private Font3 As New Font(FontFamily.GenericSansSerif, 44, FontStyle.Bold)
|
|
Private Font4 As New Font(FontFamily.GenericSansSerif, 44, FontStyle.Bold)
|
|
Private Font5 As New Font(FontFamily.GenericSansSerif, 30, FontStyle.Bold)
|
|
Private Font6 As New Font(FontFamily.GenericSansSerif, 30, FontStyle.Bold)
|
|
Private Font7 As New Font(FontFamily.GenericSansSerif, 30, FontStyle.Bold)
|
|
|
|
Dim GridBackgroundColor As Color = Color.FromArgb(240, 245, 255)
|
|
Dim TESTSYSTEM As Boolean = False
|
|
Private isloaded As Boolean = False
|
|
|
|
Private Sekunden As Integer = 10
|
|
|
|
Dim StandortDatei As String = Application.StartupPath & "\Standort.txt"
|
|
|
|
Private Sub frmAnzeige_KeyUp(sender As Object, e As KeyEventArgs) Handles Me.KeyUp
|
|
If e.KeyCode = Keys.PageDown Then
|
|
Listen_ermitteln()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub frmAnzeige_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
|
|
' Cursor.Position = Me.PointToScreen(New Point(Me.Width, Me.Height))
|
|
|
|
Me.CenterToScreen()
|
|
StandortATILLA = False
|
|
|
|
Me.Left = 0
|
|
Me.Top = 0
|
|
Me.Width = 1920
|
|
Me.Height = 1080
|
|
|
|
Me.Text += " " & Application.ProductVersion
|
|
|
|
|
|
'Falls kein File vorhanden, dann werden alle angezeigt
|
|
If Standort = "" Then
|
|
|
|
If Not File.Exists(StandortDatei) Then
|
|
Standort = ""
|
|
Else
|
|
Dim fs As New FileStream(StandortDatei, FileMode.Open, FileAccess.Read)
|
|
Dim strmReader As New StreamReader(fs)
|
|
Standort = strmReader.ReadLine
|
|
fs.Close()
|
|
End If
|
|
End If
|
|
|
|
If cDatenbankAVISO.GlobalConnection IsNot Nothing Then cDatenbankAVISO.GlobalConnection.Close()
|
|
cDatenbankAVISO.GlobalConnection = Nothing
|
|
|
|
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = TESTSYSTEM
|
|
If TESTSYSTEM Then
|
|
Button2.Text = "Zum Echtsystem wechseln"
|
|
Else
|
|
Button2.Text = "Zum Testsystem wechseln"
|
|
End If
|
|
|
|
Panel1.BackColor = Color.FromArgb(0, 54, 128)
|
|
lblZeit.BackColor = Color.FromArgb(0, 54, 128)
|
|
lblAnzahl.BackColor = Color.FromArgb(0, 54, 128)
|
|
lblSeite.BackColor = Color.FromArgb(0, 54, 128)
|
|
Label11.ForeColor = Color.White
|
|
lblZeit.ForeColor = Color.White
|
|
Panel1.ForeColor = Color.White
|
|
lblAnzahl.ForeColor = Color.White
|
|
lblSeite.ForeColor = Color.White
|
|
|
|
VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "VERAG"
|
|
'Standort Atilla bekommt Sonderanzeige
|
|
If Standort = "ATILLA" Then
|
|
VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "ATILLA"
|
|
StandortATILLA = True
|
|
ZeilenStandard = ZeilenATILLA
|
|
'jetzt noch Standort auf leer setzen, damit alles angezeigt wird
|
|
Standort = ""
|
|
ElseIf Standort = "IMEX" Then
|
|
VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "IMEX"
|
|
Panel1.BackColor = Color.Gold
|
|
Panel1.BackColor = Color.Gold
|
|
lblZeit.BackColor = Color.Gold
|
|
lblAnzahl.BackColor = Color.Gold
|
|
lblSeite.BackColor = Color.Gold
|
|
|
|
Label11.ForeColor = Color.Black
|
|
lblZeit.ForeColor = Color.Black
|
|
Panel1.ForeColor = Color.Black
|
|
lblAnzahl.ForeColor = Color.Black
|
|
lblSeite.ForeColor = Color.Black
|
|
|
|
'gridAnkunft.BackgroundColor = Color.FromArgb(255, 255, 240)
|
|
GridBackgroundColor = Color.FromArgb(255, 255, 240)
|
|
|
|
|
|
End If
|
|
|
|
gridAnkunft.AlternatingRowsDefaultCellStyle.BackColor = GridBackgroundColor
|
|
'Standort Suben12 bekommt Sonderanzeige
|
|
If Standort = "SUB12" Then
|
|
Max_Zeilen = 12
|
|
ZeilenStandard = 12
|
|
StandortSUB12 = True
|
|
'jetzt noch Standort anpassen, damit alles angezeigt wird
|
|
Standort = "SUB"
|
|
End If
|
|
|
|
If Standort = "VERAG_ALLE" Then
|
|
Standort = ""
|
|
End If
|
|
|
|
|
|
|
|
|
|
Merk_Ankunftsdatum = LeerDatum
|
|
|
|
Listen_ermitteln()
|
|
|
|
loadsettings()
|
|
initSettings()
|
|
|
|
|
|
'Timer starten
|
|
hMerkZeit = Now
|
|
Timer1.Enabled = True
|
|
|
|
End Sub
|
|
|
|
WithEvents timerRemove As New Timer
|
|
|
|
|
|
|
|
|
|
Private Sub timerRemove_Tick(sender As Object, e As EventArgs) Handles timerRemove.Tick
|
|
Exit Sub
|
|
For Each c As Control In Me.Controls
|
|
'MsgBox(c.Name)
|
|
If c.Name.Contains("TMPpic") Then
|
|
'MsgBox(c.Name)
|
|
Me.Controls.Remove(c)
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
|
|
Dim contrnamecnt As Integer = 0
|
|
Public Sub Listen_ermitteln()
|
|
Dim connok As Boolean = False
|
|
Try
|
|
Dim conn As SqlConnection = cDatenbankAVISO.GetNewOpenConnectionWithoutError()
|
|
If conn Is Nothing Then
|
|
picConnectionProblem.Visible = True
|
|
Else
|
|
picConnectionProblem.Visible = False
|
|
connok = True
|
|
conn.Close()
|
|
End If
|
|
' End Using
|
|
'conn.Close()
|
|
Catch ex As Exception
|
|
'MsgBox("what " & ex.Message)
|
|
End Try
|
|
|
|
If connok Then
|
|
clmnBuero.Visible = StandortATILLA
|
|
clmnImEx.Visible = (Standort = "WAI")
|
|
|
|
If Aktive_Seite <= Max_Seiten Then Aktive_Seite += 1 'nächste Seite anzeigen
|
|
|
|
If Aktive_Seite > Max_Seiten Then
|
|
Merk_Ankunftsdatum = LeerDatum 'falls letzte Seite angezeigt, dann wieder von vorne anfangen
|
|
Aktive_Seite = 1
|
|
End If
|
|
Dim buero As String = ""
|
|
If StandortATILLA Then
|
|
buero = " , Buero "
|
|
End If
|
|
Dim stat_tmp As String = cGlobal.Status_Ankunft.ToString
|
|
Dim ank_tmp As String = " AND Ankunft > " & SQLDatumZeitSekunden(Merk_Ankunftsdatum)
|
|
|
|
If False Then 'alle Staten
|
|
stat_tmp = "3,99,4,5,0"
|
|
ank_tmp = ""
|
|
End If
|
|
|
|
Dim where As String = " WHERE "
|
|
Dim hSQL As String = "SELECT AvisoID, Status, UPPER(LKW_Nr) as LKW_Nr, Ankunft, Dauer, letzterMitarbeiter, LKW_fertig " & buero & " , AvisoTVHinweis, ImEx FROM Aviso "
|
|
where &= " Status IN( " & stat_tmp & ") AND Firma= '" & VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & "' "
|
|
If Standort <> "" Then where &= " AND Grenzstelle = '" & Standort.Replace("IMEX", "SUB") & "'" 'nur die IMEX-LKW in SUB anzeigen
|
|
hSQL &= where
|
|
hSQL += ank_tmp & " ORDER BY CASE " &
|
|
" when [Status] =3 then 1 " &
|
|
" when [Status] =99 then 2 " &
|
|
" when [Status] =4 then 3 " &
|
|
" when [Status] =5 then 4 " &
|
|
" when [Status] =0 then 4 " &
|
|
" END , Ankunft"
|
|
' MsgBox(hSQL)
|
|
'Anzahl der Aviso mit Status Ankunft ermitteln
|
|
Dim CheckAnzahl As String = "SELECT AvisoID FROM Aviso " & where 'WHERE Status IN( " & stat_tmp & ") "
|
|
' If Standort <> "" Then CheckAnzahl += " AND Grenzstelle = '" & Standort.Replace("IMEX", "SUB") & "'"
|
|
Anzahl_alle = AvisoDAL.Anzahl_Aviso_ermitteln(CheckAnzahl)
|
|
lblAnzahl.Text = Anzahl_alle.ToString
|
|
Max_Seiten = VarToInt(Fix(Anzahl_alle / ZeilenStandard))
|
|
If Anzahl_alle Mod ZeilenStandard <> 0 Then Max_Seiten += 1
|
|
'Max_Seiten = (Anzahl_alle Mod 8) + 1
|
|
|
|
|
|
timerRemove.enabled = True
|
|
contrnamecnt = 0
|
|
Dim anz As Integer = 0
|
|
Try
|
|
Dim conn As SqlConnection = cDatenbankAVISO.GetNewOpenConnectionWithoutError()
|
|
removeControls()
|
|
' MsgBox(hSQL)
|
|
'If IsNothing(conn) Then Exit Sub 'Fehler bei DB-Zugriff - Anzeige nicht aktualisieren
|
|
Using cmd As New SqlCommand(hSQL, conn)
|
|
' MsgBox(conn.ConnectionString)
|
|
Dim dr = cmd.ExecuteReader()
|
|
'MsgBox(cmd.Connection.ConnectionString)
|
|
If Not IsNothing(dr) Then
|
|
gridAnkunft.Rows.Clear() 'Ansicht löschen
|
|
|
|
While dr.Read()
|
|
' MsgBox(VarToStr(dr.Item("LKW_Nr")))
|
|
anz += 1
|
|
Dim LKW_Nr As String = VarToStr(dr.Item("LKW_Nr"))
|
|
Dim hAnkunft As String = Format(CDate(VarToDate((dr.Item("Ankunft")))), "dd.MM. HH:mm")
|
|
Dim hDauer As Long = DateDiff(DateInterval.Minute, CDate(VarToDate((dr.Item("Ankunft")))), Now)
|
|
Dim Dauer As String = Minuten_auf_Text(hDauer)
|
|
Dim hMitarbeiter As String = VarToStr(dr.Item("LetzterMitarbeiter"))
|
|
Dim ImEx As String = VarToStr(dr.Item("ImEx"))
|
|
|
|
If StandortATILLA Or Standort = "IMEX" Then
|
|
'bei Mitarbeiter nur User aus letzter Bearbeiter rausfiltern
|
|
Dim x As String = ""
|
|
Dim n As Integer = 0
|
|
While n < hMitarbeiter.Length
|
|
If hMitarbeiter.Substring(n, 1) <> "/" Then
|
|
x += hMitarbeiter.Substring(n, 1)
|
|
Else
|
|
Exit While
|
|
End If
|
|
n += 1
|
|
End While
|
|
hMitarbeiter = x
|
|
End If
|
|
|
|
Dim hFertig As String = ""
|
|
' If VarToBool(dr.Item("LKW_fertig")) Then hFertig = "OK"
|
|
|
|
If VarToStr(dr.Item("AvisoTVHinweis")) <> "" Then
|
|
hFertig = VarToStr(dr.Item("AvisoTVHinweis"))
|
|
ElseIf VarToBool(dr.Item("LKW_fertig")) Then
|
|
hFertig = "OK"
|
|
End If
|
|
|
|
If anz <= Max_Zeilen Then
|
|
|
|
If StandortATILLA Then
|
|
Dim hBuero As String = VarToStr(dr.Item("buero"))
|
|
gridAnkunft.Rows.Add(hFertig, LKW_Nr, hAnkunft, Dauer, hMitarbeiter, hBuero)
|
|
ElseIf Standort = "WAI" Then
|
|
If ImEx = "IMPORT" Then ImEx = "IM"
|
|
If ImEx = "EXPORT" Then ImEx = "EX"
|
|
' MsgBox(ImEx)
|
|
gridAnkunft.Rows.Add(hFertig, LKW_Nr, hAnkunft, Dauer, hMitarbeiter, "", ImEx)
|
|
Else
|
|
gridAnkunft.Rows.Add(hFertig, LKW_Nr, hAnkunft, Dauer, hMitarbeiter)
|
|
End If
|
|
|
|
If ImEx <> "" Then
|
|
Dim r As DataGridViewRow = gridAnkunft.Rows(gridAnkunft.RowCount - 1)
|
|
r.Cells("clmnImEx").Style.ForeColor = Color.White
|
|
If ImEx = "IM" Then r.Cells("clmnImEx").Style.BackColor = Color.Green
|
|
If ImEx = "EX" Then r.Cells("clmnImEx").Style.BackColor = Color.Blue
|
|
End If
|
|
|
|
If VarToStr(dr.Item("AvisoTVHinweis")) <> "" Then
|
|
Dim r As DataGridViewRow = gridAnkunft.Rows(gridAnkunft.RowCount - 1)
|
|
r.Cells(0).Style.ForeColor = Color.Red
|
|
r.Cells(1).Style.ForeColor = Color.Red
|
|
r.Cells(0).Style.Font = Font1_MESS
|
|
Dim doimage As Image = Nothing
|
|
Select Case r.Cells(0).Value.ToString
|
|
Case "PASSPORT" : doimage = My.Resources.passport : r.Cells(0).Value = "PASSPORT" ' r.Cells(0).Value = "PASS"
|
|
Case "DOKUMENT" : doimage = My.Resources.passport : r.Cells(0).Value = "PROBLEM" ' r.Cells(0).Value = "PASS"
|
|
Case "URGENT" : doimage = My.Resources.urgent_qu : r.Cells(0).Value = "PROBLEM"
|
|
End Select
|
|
|
|
doimage = Nothing
|
|
If doimage IsNot Nothing Then
|
|
r.Cells(0).Style.Alignment = DataGridViewContentAlignment.MiddleRight
|
|
|
|
|
|
|
|
Dim pic As New PictureBox
|
|
pic.Location = getLocation(gridAnkunft, r)
|
|
pic.BackColor = r.Cells(0).Style.BackColor
|
|
pic.Image = doimage
|
|
|
|
pic.Height = r.Cells(0).Size.Height - 2 : pic.Width = pic.Height
|
|
pic.SizeMode = PictureBoxSizeMode.Zoom
|
|
pic.Name = "TMPpic" & contrnamecnt
|
|
|
|
Me.Controls.Add(pic)
|
|
'Me.Controls(pic.Name).BringToFront()
|
|
pic.BringToFront()
|
|
contrnamecnt += 1
|
|
' MsgBox(pic.Name)
|
|
End If
|
|
End If
|
|
|
|
Merk_Ankunftsdatum = CDate(VarToDate((dr.Item("Ankunft")))).AddSeconds(1)
|
|
' lblZeile1.Text = Merk_Ankunftsdatum.ToShortDateString & Merk_Ankunftsdatum.ToShortTimeString
|
|
' lblZeile1.Refresh()
|
|
End If
|
|
End While
|
|
End If
|
|
dr.Close()
|
|
End Using
|
|
Catch ex As Exception
|
|
MsgBox("ERR: " & ex.Message)
|
|
MsgBox("ERR: " & ex.StackTrace)
|
|
End Try
|
|
|
|
'Ermitteln
|
|
If Max_Seiten > 0 Then
|
|
lblSeite.Text = Aktive_Seite.ToString & "/" & Max_Seiten.ToString
|
|
Else
|
|
lblSeite.Text = "0/0"
|
|
End If
|
|
|
|
'Infotext auslesen
|
|
Dim AvisoTVDAL As New cAvisoTVDAL
|
|
Dim AvisoTV As New cAvisoTV
|
|
AvisoTV = AvisoTVDAL.LesenAvisoTV(1, "")
|
|
displayZeilen = False
|
|
If Not IsNothing(AvisoTV) Then
|
|
' MsgBox(lblZeile1.Text)
|
|
displayZeilen = True
|
|
lblZeile1.Text = AvisoTV.FixeZeile1.Trim
|
|
lblZeile2.Text = AvisoTV.FixeZeile2.Trim
|
|
End If
|
|
|
|
lblZeit.Text = Format(Now, "dd.MM. HH:mm:ss")
|
|
|
|
End If
|
|
For Each c As Control In gridAnkunft.Parent.Controls
|
|
If c.Name.ToString.Contains("TMPpic") Then
|
|
c.BringToFront()
|
|
End If
|
|
Next
|
|
gridAnkunft.ClearSelection() 'wenn erste Zeile Markiert, Problem mit Farblicher Darstellung
|
|
End Sub
|
|
|
|
Sub removeControls()
|
|
For Each c As Control In Me.Controls
|
|
'MsgBox(c.Name)
|
|
If c.Name.Contains("TMPpic") Then
|
|
'MsgBox(c.Name)
|
|
Me.Controls.Remove(c)
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Function getLocation(d As DataGridView, r As DataGridViewRow) As Point
|
|
Dim CellRectangle1 As Rectangle = d.GetCellDisplayRectangle(0, d.RowCount - 1, False)
|
|
CellRectangle1.X += d.Left
|
|
CellRectangle1.Y += d.Top + r.Height
|
|
Return PointToScreen(New Point(CellRectangle1.X, CellRectangle1.Y - r.Cells(0).Size.Height))
|
|
End Function
|
|
|
|
Private Sub dataGridView1_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles gridAnkunft.CellPainting
|
|
Exit Sub
|
|
If e.ColumnIndex = 0 Then
|
|
If gridAnkunft.Rows(e.RowIndex).Cells(0).Value.ToString = "" Then
|
|
'Dim newImage As Image = Image.FromFile("Images/image.jpg")
|
|
Dim maskImage As Image = My.Resources.waitLKW
|
|
' e.Graphics.DrawImage(newImage, e.CellBounds.Left + 2, e.CellBounds.Top + 2, 26, 26)
|
|
e.Graphics.DrawImage(maskImage, e.CellBounds.Left, e.CellBounds.Top, 30, 30)
|
|
e.Handled = True
|
|
Else
|
|
e.Handled = False
|
|
End If
|
|
End If
|
|
If False Then
|
|
For Each r As DataGridViewRow In gridAnkunft.Rows
|
|
If r.Cells(0).Value.ToString = "" Then
|
|
'Dim newImage As Image = Image.FromFile("Images/image.jpg")
|
|
Dim maskImage As Image = My.Resources.waitLKW
|
|
' e.Graphics.DrawImage(newImage, e.CellBounds.Left + 2, e.CellBounds.Top + 2, 26, 26)
|
|
Dim c As DataGridViewCell = r.Cells(0)
|
|
gridAnkunft.CreateGraphics.DrawImage(maskImage, c.ContentBounds.Left, c.ContentBounds.Top, 30, 30)
|
|
' e.Handled = True
|
|
Else
|
|
'e.Handled = False
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
|
|
lblZeit.Text = Format(Now, "dd.MM. HH:mm:ss")
|
|
lblZeit.Refresh()
|
|
If DateDiff(DateInterval.Second, hMerkZeit, Now) > Sekunden Then 'aktualisieren alle xx Sekunden
|
|
If Not grpTestAnzeige.Visible Then
|
|
If Cursor.Position = cptmp Then
|
|
Cursor.Position = Me.PointToScreen(New Point(0, Me.Height))
|
|
End If
|
|
cptmp = Cursor.Position
|
|
End If
|
|
Listen_ermitteln()
|
|
hMerkZeit = Now
|
|
' MsgBox("now")
|
|
|
|
If (lblZeile1.Text & lblZeile1.Text).Trim = String.Empty Then displayZeilen = False : 'wenn alles leer
|
|
If displayZeilen Then
|
|
lblZeile1.Visible = Not lblZeile1.Visible
|
|
lblZeile2.Visible = Not lblZeile2.Visible
|
|
Else
|
|
lblZeile1.Visible = False
|
|
lblZeile2.Visible = False
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub gridAnkunft_DoubleClick(sender As Object, e As System.EventArgs) Handles gridAnkunft.DoubleClick
|
|
|
|
txtBreite.Text = Me.Width.ToString
|
|
txtHöhe.Text = Me.Height.ToString
|
|
|
|
grpTestAnzeige.Visible = True
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
|
|
grpTestAnzeige.Visible = False
|
|
Cursor.Position = Me.PointToScreen(New Point(Me.Width, Me.Height))
|
|
End Sub
|
|
Sub initSettings()
|
|
initZeilen()
|
|
|
|
Select Case Standort
|
|
Case "ATILLA" : picVERAG.Image = My.Resources.Atilla 'Atilla such su
|
|
Case "IMEX" : picVERAG.Image = My.Resources.IMEX_LOGO_simple
|
|
Case Else : picVERAG.Image = My.Resources.Verag_AG_Logopng
|
|
End Select
|
|
If StandortATILLA Then picVERAG.Image = My.Resources.Atilla
|
|
|
|
'If StandortATILLA Then
|
|
' picVERAG.Image = My.Resources.Atilla
|
|
'Else
|
|
' picVERAG.Image = My.Resources.Verag_AG_Logopng
|
|
'End If
|
|
|
|
If txtBreite.Text <> "" Then
|
|
If VarToInt(txtBreite.Text) < 800 Then
|
|
MsgBox("Breite ist zu klein - mind. 800")
|
|
txtBreite.Focus()
|
|
Exit Sub
|
|
End If
|
|
Me.Width = VarToInt(txtBreite.Text)
|
|
End If
|
|
|
|
If txtHöhe.Text <> "" Then
|
|
If VarToInt(txtHöhe.Text) < 600 Then
|
|
MsgBox("Höhe ist zu klein - mind. 600")
|
|
txtHöhe.Focus()
|
|
Exit Sub
|
|
End If
|
|
Me.Height = VarToInt(txtHöhe.Text)
|
|
End If
|
|
|
|
If txtSchrift1.Text <> "" Then
|
|
If VarToInt(txtSchrift1.Text) < 10 Then
|
|
MsgBox("Schrift1 ist zu klein - mind. 10")
|
|
txtSchrift1.Focus()
|
|
Exit Sub
|
|
End If
|
|
Font1 = New Font(FontFamily.GenericSansSerif, VarToInt(txtSchrift1.Text), FontStyle.Bold)
|
|
End If
|
|
|
|
If txtSchrift1_MESS.Text <> "" Then
|
|
If VarToInt(txtSchrift1_MESS.Text) < 10 Then
|
|
MsgBox("Schrift1 ist zu klein - mind. 10")
|
|
txtSchrift1_MESS.Focus()
|
|
Exit Sub
|
|
End If
|
|
Font1_MESS = New Font(FontFamily.GenericSansSerif, VarToInt(txtSchrift1_MESS.Text), FontStyle.Bold)
|
|
End If
|
|
|
|
If txtSchrift2.Text <> "" Then
|
|
If VarToInt(txtSchrift2.Text) < 10 Then
|
|
MsgBox("Schrift2 ist zu klein - mind. 10")
|
|
txtSchrift2.Focus()
|
|
Exit Sub
|
|
End If
|
|
Font2 = New Font(FontFamily.GenericSansSerif, VarToInt(txtSchrift2.Text), FontStyle.Bold)
|
|
End If
|
|
|
|
If txtSchrift3.Text <> "" Then
|
|
If VarToInt(txtSchrift3.Text) < 10 Then
|
|
MsgBox("Schrift3 ist zu klein - mind. 10")
|
|
txtSchrift3.Focus()
|
|
Exit Sub
|
|
End If
|
|
Font3 = New Font(FontFamily.GenericSansSerif, VarToInt(txtSchrift3.Text), FontStyle.Bold)
|
|
End If
|
|
|
|
If txtSekunden.Text <> "" Then
|
|
If VarToInt(txtSekunden.Text) < 10 Then
|
|
MsgBox("Resfresh unter 10 Sekunden ist nicht erlaubt.")
|
|
txtSekunden.Focus()
|
|
Exit Sub
|
|
End If
|
|
End If
|
|
|
|
If txtSchrift4.Text <> "" Then Font4 = New Font(FontFamily.GenericSansSerif, VarToInt(txtSchrift4.Text), FontStyle.Bold)
|
|
If txtSchrift5.Text <> "" Then Font5 = New Font(FontFamily.GenericSansSerif, VarToInt(txtSchrift5.Text), FontStyle.Bold)
|
|
If txtSchrift6.Text <> "" Then Font6 = New Font(FontFamily.GenericSansSerif, VarToInt(txtSchrift6.Text), FontStyle.Bold)
|
|
If txtSchrift7.Text <> "" Then Font7 = New Font(FontFamily.GenericSansSerif, VarToInt(txtSchrift7.Text), FontStyle.Bold)
|
|
|
|
gridAnkunft.Columns(0).DefaultCellStyle.Font = Font1
|
|
gridAnkunft.Columns(1).DefaultCellStyle.Font = Font2
|
|
gridAnkunft.Columns(2).DefaultCellStyle.Font = Font3
|
|
gridAnkunft.Columns(3).DefaultCellStyle.Font = Font4
|
|
gridAnkunft.Columns(4).DefaultCellStyle.Font = Font5
|
|
|
|
If StandortATILLA And gridAnkunft.Columns("clmnBuero") IsNot Nothing Then
|
|
gridAnkunft.Columns("clmnBuero").Width = CInt(IIf(IsNumeric(txtBreite6.Text), txtBreite6.Text, 50))
|
|
gridAnkunft.Columns("clmnBuero").DefaultCellStyle.Font = Font6
|
|
gridAnkunft.Columns("clmnBuero").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
|
|
End If
|
|
|
|
If Standort = "WAI" And gridAnkunft.Columns("clmnImEx") IsNot Nothing Then
|
|
' MsgBox(IIf(IsNumeric(txtBreite7.Text), txtBreite7.Text, 30))
|
|
gridAnkunft.Columns("clmnImEx").Width = CInt(IIf(IsNumeric(txtBreite7.Text), txtBreite7.Text, 50))
|
|
gridAnkunft.Columns("clmnImEx").DefaultCellStyle.Font = Font7
|
|
gridAnkunft.Columns("clmnImEx").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
|
|
End If
|
|
|
|
|
|
If txtBreite1.Text <> "" Then gridAnkunft.Columns(0).Width = CInt(txtBreite1.Text)
|
|
If txtBreite2.Text <> "" Then gridAnkunft.Columns(1).Width = CInt(txtBreite2.Text)
|
|
If txtBreite3.Text <> "" Then gridAnkunft.Columns(2).Width = CInt(txtBreite3.Text)
|
|
If txtBreite4.Text <> "" Then gridAnkunft.Columns(3).Width = CInt(txtBreite4.Text)
|
|
gridAnkunft.Columns(4).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
|
|
|
|
|
|
'gridAnkunft.Columns(4).Width = Me.Width - gridAnkunft.Columns(0).Width - gridAnkunft.Columns(1).Width - gridAnkunft.Columns(2).Width - gridAnkunft.Columns(3).Width - 20
|
|
'txtBreite5.Text = gridAnkunft.Columns(4).Width.ToString
|
|
|
|
If txtSekunden.Text <> "" Then
|
|
Sekunden = VarToInt(txtSekunden.Text.Trim)
|
|
If Sekunden < 10 Then Sekunden = 10
|
|
End If
|
|
savesettings()
|
|
|
|
|
|
End Sub
|
|
|
|
Sub initZeilen()
|
|
' MsgBox(gridAnkunft.Rows(0).Cells(0).Size.Height)
|
|
If gridAnkunft.RowCount > 0 Then
|
|
ZeilenStandard = CInt(gridAnkunft.Height / gridAnkunft.Rows(0).Cells(0).Size.Height) - 1
|
|
Else
|
|
ZeilenStandard = 8
|
|
End If
|
|
Max_Zeilen = ZeilenStandard
|
|
'MsgBox(ZeilenStandard)
|
|
Aktive_Seite = 0
|
|
Merk_Ankunftsdatum = LeerDatum
|
|
Listen_ermitteln()
|
|
|
|
End Sub
|
|
|
|
Private Sub btnTestAnzeige_Click(sender As System.Object, e As System.EventArgs) Handles btnTestAnzeige.Click
|
|
isloaded = False
|
|
initSettings()
|
|
grpTestAnzeige.Visible = False
|
|
End Sub
|
|
|
|
Private Sub btnTestSystem_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
|
|
TESTSYSTEM = Not TESTSYSTEM
|
|
frmAnzeige_Load(Me, New EventArgs)
|
|
End Sub
|
|
|
|
|
|
|
|
Sub loadsettings()
|
|
For Each c In grpTestAnzeige.Controls
|
|
If c.GetType.Name = "TextBox" Then
|
|
Dim p As String = getProperty(DirectCast(c, TextBox).Name)
|
|
If p <> "" Then DirectCast(c, TextBox).Text = p
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Sub savesettings()
|
|
If txtBreite.Text <> "" Then setProperty("txtBreite", txtBreite.Text)
|
|
If txtHöhe.Text <> "" Then setProperty("txtHöhe", txtHöhe.Text)
|
|
If txtSchrift1.Text <> "" Then setProperty("txtSchrift1", txtSchrift1.Text)
|
|
If txtSchrift1_MESS.Text <> "" Then setProperty("txtSchrift1_MESS", txtSchrift1_MESS.Text)
|
|
|
|
If txtSchrift2.Text <> "" Then setProperty("txtSchrift2", txtSchrift2.Text)
|
|
If txtSchrift3.Text <> "" Then setProperty("txtSchrift3", txtSchrift3.Text)
|
|
If txtSchrift4.Text <> "" Then setProperty("txtSchrift4", txtSchrift4.Text)
|
|
If txtSchrift5.Text <> "" Then setProperty("txtSchrift5", txtSchrift5.Text)
|
|
If txtSchrift6.Text <> "" Then setProperty("txtSchrift6", txtSchrift6.Text)
|
|
If txtSchrift7.Text <> "" Then setProperty("txtSchrift7", txtSchrift7.Text)
|
|
If txtBreite1.Text <> "" Then setProperty("txtBreite1", txtBreite1.Text)
|
|
If txtBreite2.Text <> "" Then setProperty("txtBreite2", txtBreite2.Text)
|
|
If txtBreite3.Text <> "" Then setProperty("txtBreite3", txtBreite3.Text)
|
|
If txtBreite4.Text <> "" Then setProperty("txtBreite4", txtBreite4.Text)
|
|
If txtBreite5.Text <> "" Then setProperty("txtBreite5", txtBreite5.Text)
|
|
If txtBreite6.Text <> "" Then setProperty("txtBreite6", txtBreite6.Text)
|
|
If txtBreite7.Text <> "" Then setProperty("txtBreite7", txtBreite7.Text)
|
|
|
|
If txtSekunden.Text <> "" Then setProperty("txtSekunden", txtSekunden.Text)
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub lblSeite_Click(sender As Object, e As EventArgs) Handles lblSeite.Click
|
|
Listen_ermitteln()
|
|
End Sub
|
|
|
|
Private Sub gridAnkunft_Paint(sender As Object, e As PaintEventArgs) Handles gridAnkunft.Paint
|
|
If Not isloaded Then initZeilen() : isloaded = True
|
|
|
|
End Sub
|
|
|
|
Private Sub frmAnzeige_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
|
gridAnkunft.ClearSelection()
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
|
|
Me.Close()
|
|
End Sub
|
|
|
|
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
|
|
Standort = ComboBox1.Text
|
|
cDatenbankAVISO.GlobalConnection = Nothing
|
|
' Dim fs As New FileStream(StandortDatei, FileMode.Open, FileAccess.Write)
|
|
Dim strmWriter As New StreamWriter(StandortDatei, False)
|
|
strmWriter.WriteLine(ComboBox1.Text)
|
|
strmWriter.Close() ' fs.Close()
|
|
frmAnzeige_Load(Me, New EventArgs)
|
|
grpTestAnzeige.Visible = False
|
|
End Sub
|
|
|
|
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
|
Me.WindowState = FormWindowState.Minimized
|
|
End Sub
|
|
|
|
Private Sub txtBreite1_KeyUp(sender As Object, e As KeyEventArgs) Handles txtSchrift1_MESS.KeyUp, txtSekunden.KeyUp,
|
|
txtSchrift1.KeyUp, txtSchrift2.KeyUp, txtSchrift3.KeyUp, txtSchrift4.KeyUp, txtSchrift5.KeyUp, txtSchrift6.KeyUp, txtSchrift7.KeyUp,
|
|
txtBreite1.KeyUp, txtBreite2.KeyUp, txtBreite3.KeyUp, txtBreite4.KeyUp, txtBreite5.KeyUp, txtBreite6.KeyUp, txtBreite7.KeyUp
|
|
|
|
If e.KeyCode = Keys.Return Then
|
|
btnTestAnzeige.PerformClick()
|
|
e.Handled = True
|
|
e.SuppressKeyPress = True
|
|
End If
|
|
End Sub
|
|
|
|
Dim secondmonitorSelected As Boolean = False
|
|
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
|
|
Dim secondaryMonitor = Screen.AllScreens.FirstOrDefault(Function(x) Not x.Primary)
|
|
If secondmonitorSelected Then
|
|
secondaryMonitor = Screen.AllScreens.FirstOrDefault(Function(x) x.Primary) 'Hauptbildschirm
|
|
End If
|
|
If secondaryMonitor IsNot Nothing Then
|
|
Me.WindowState = FormWindowState.Normal
|
|
Dim newLocation = secondaryMonitor.Bounds.Location
|
|
newLocation.Offset(0, 0) ' adjust as needed
|
|
Me.Location = newLocation
|
|
Me.Refresh()
|
|
Me.WindowState = FormWindowState.Maximized
|
|
' Also see Me.Size and Me.Bounds
|
|
End If
|
|
secondmonitorSelected = Not secondmonitorSelected
|
|
End Sub
|
|
End Class
|
|
|
|
|
|
Public Class cUserSettings
|
|
|
|
Shared settings As New List(Of cListUserSettings)
|
|
Public Shared Sub setProperty(ByVal name As String, ByVal value As String)
|
|
settings = New List(Of cListUserSettings)
|
|
loadPropertys()
|
|
setNewProperty(name, value)
|
|
writesettings()
|
|
End Sub
|
|
|
|
Public Shared Function getProperty(ByVal name As String) As String
|
|
settings = New List(Of cListUserSettings)
|
|
loadPropertys()
|
|
For Each a In settings
|
|
If a.name = name Then Return a.value
|
|
Next
|
|
Return ""
|
|
End Function
|
|
|
|
|
|
Shared Sub setNewProperty(ByVal name As String, ByVal value As String)
|
|
For Each a In settings
|
|
If a.name = name Then
|
|
a.value = value
|
|
Exit Sub
|
|
End If
|
|
Next
|
|
'settings.Add(New Dictionary(name, value))
|
|
|
|
settings.Add(New cListUserSettings(name, value))
|
|
End Sub
|
|
Shared Sub loadPropertys()
|
|
Try
|
|
Using sr As New StreamReader(AppDomain.CurrentDomain.BaseDirectory & "settings.txt")
|
|
Dim line As String = ""
|
|
Do While sr.Peek() >= 0
|
|
line = CStr(sr.ReadLine())
|
|
If line.Contains(Chr(29)) Then
|
|
Dim s = line.Split(Chr(29)) 'nach GroupSeperator splitten
|
|
'If s(0) = name Then Return True
|
|
settings.Add(New cListUserSettings(s(0), s(1)))
|
|
End If
|
|
Loop
|
|
End Using
|
|
Catch ex As Exception
|
|
' MsgBox("FEHLER beim Einlesen der UserSettings.")
|
|
End Try
|
|
End Sub
|
|
Shared Sub writesettings()
|
|
Try
|
|
Using sr As New StreamWriter(AppDomain.CurrentDomain.BaseDirectory & "settings.txt", False)
|
|
For Each a In settings
|
|
sr.WriteLine(a.name & Chr(29) & a.value)
|
|
Next
|
|
End Using
|
|
Catch ex As Exception
|
|
End Try
|
|
End Sub
|
|
|
|
|
|
End Class
|
|
|
|
Public Class cListUserSettings
|
|
Property name As String
|
|
Property value As String
|
|
Sub New(ByVal n As String, v As String)
|
|
name = n
|
|
value = v
|
|
End Sub
|
|
End Class |