Imports System.IO

Public Class usrCntLPDFScanSimple
    Public ScanID As String = ""
    Public pdf_Path As String = ""
    Public bezeichnung As String = ""
    Public archived As Boolean = False
    Public Event DELETE(ScanID As Integer, bezeichnung As String)
    Public Event RENAME(ScanID As Integer, bezeichnung As String)
    Public Event ARCHIV(ScanID As Integer, bezeichnung As String)
    Public Event CLIPBOARD(ScanID As Integer, bezeichnung As String)
    Public Event OPEN_MAIL(ScanID As Integer, bezeichnung As String)

    Public Event CLICKED()

    Sub New(ScanID, pdf_Path, bezeichnung, archived)

        ' Dieser Aufruf ist für den Designer erforderlich.
        InitializeComponent()

        ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
        Me.ScanID = ScanID
        Me.pdf_Path = pdf_Path
        Me.bezeichnung = bezeichnung
        txt.Text = bezeichnung
        Me.archived = archived
    End Sub

    Private Sub LöschenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LöschenToolStripMenuItem.Click
        If VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_Datenarchiv_DELETE", "SDL") Then RaiseEvent DELETE(ScanID, bezeichnung)
    End Sub

    Private Sub txt_Click(sender As Object, e As EventArgs) Handles txt.Click, Me.Click, picPDF.Click
        If File.Exists(pdf_Path) Then
            '  Process.Start(pdf_Path) 
             Process.Start(VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.copyToTmp_KeepFilename(pdf_Path, bezeichnung))
            RaiseEvent CLICKED()
        End If
    End Sub

    Private Sub usrCntLPDFScanSimple_Load(sender As Object, e As EventArgs) Handles Me.Load
        If archived Then
            ArchivierenToolStripMenuItem.Text = "Wiederherstellen"
            Me.picPDF.BackgroundImage = My.Resources.pdf_gray
        End If
        LöschenToolStripMenuItem.Enabled = VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_Datenarchiv_DELETE", "SDL")

    End Sub

    Private Sub usrcntlPDFScan_MouseHover(sender As Object, e As EventArgs) Handles Me.MouseEnter, txt.MouseEnter, picPDF.MouseEnter
        Me.BackColor = Drawing.Color.LightGray
    End Sub
    Private Sub usrcntlPDFScan_MouseLeave(sender As Object, e As EventArgs) Handles Me.MouseLeave, txt.MouseLeave, picPDF.MouseLeave
        Me.BackColor = Drawing.Color.White
    End Sub

    Private Sub UmbenennenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles UmbenennenToolStripMenuItem.Click
        RaiseEvent RENAME(ScanID, bezeichnung)
    End Sub

    Private Sub ArchivierenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ArchivierenToolStripMenuItem.Click
        RaiseEvent ARCHIV(ScanID, bezeichnung)
    End Sub

    Private Sub KopierenZwischenablageToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles KopierenZwischenablageToolStripMenuItem.Click
        RaiseEvent CLIPBOARD(ScanID, bezeichnung)
    End Sub

    Private Sub AlsEmailSendenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AlsEmailSendenToolStripMenuItem.Click
        RaiseEvent OPEN_MAIL(ScanID, bezeichnung)
    End Sub
End Class
