ms
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
Imports System.IO
|
||||
Imports DD_LIB_Standards
|
||||
|
||||
Public Class frmScanFiles
|
||||
|
||||
Dim DragID
|
||||
@@ -19,40 +21,70 @@ Public Class frmScanFiles
|
||||
Load_Files()
|
||||
ClassWindowLocation.LoadFormLocationSize(Me, 9999, CURRENT_SCREEN_ID, Me.Name)
|
||||
End Sub
|
||||
Sub Clear_and_Reload_Files()
|
||||
Try
|
||||
PdfViewer1.DocumentFilePath = ""
|
||||
Dim del = "DELETE FROM TBPMO_FILES_USER where HANDLE_TYPE = 'SCAN' AND UPPER(USER_WORK) = UPPER('" & USER_USERNAME & "')"
|
||||
If clsDatabase.Execute_non_Query(del, True) Then
|
||||
' Make a reference to a directory.
|
||||
Dim di As New DirectoryInfo(CURRENT_SCAN_FOLDERWATCH)
|
||||
' Get a reference to each file in that directory.
|
||||
Dim fiArr As FileInfo() = di.GetFiles()
|
||||
' Display the names of the files.
|
||||
|
||||
Dim fri As FileInfo
|
||||
For Each fri In fiArr
|
||||
Dim irregular As Boolean = False
|
||||
For Each row As DataRow In DTEXCLUDE_FILES.Rows
|
||||
Dim content As String = row.Item(0).ToString.ToLower
|
||||
If fri.Name.ToLower.Contains(content) Then
|
||||
irregular = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If irregular = False Then
|
||||
Dim handletype As String
|
||||
If fri.FullName.EndsWith(".msg") Then
|
||||
handletype = "SCAN_OUTLOOK_MESSAGE"
|
||||
Else
|
||||
handletype = "SCAN"
|
||||
End If
|
||||
ClassFolderWatcher.Insert_USER_File(fri.FullName, handletype)
|
||||
End If
|
||||
Next fri
|
||||
ClassFolderWatcher.Check_Scan_Files()
|
||||
Load_Files()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
Sub Load_Files()
|
||||
Try
|
||||
Dim DT As DataTable = ClassFolderWatcher.Check_Scan_Files
|
||||
If Not IsNothing(DT) Then
|
||||
CURRENT_SCAN_TABLE = DT
|
||||
ListView1.Items.Clear()
|
||||
Dim i = 0
|
||||
For Each row As DataRow In CURRENT_SCAN_TABLE.Rows
|
||||
|
||||
Dim extension = Path.GetExtension(row.Item("FILENAME2WORK").ToString)
|
||||
Dim filestring = row.Item("FILENAME2WORK")
|
||||
If ClassHelper.CheckFileIsInUse(filestring) = False Then
|
||||
Dim filename = row.Item("FILENAME_ONLY").ToString
|
||||
Dim ID = row.Item("GUID").ToString
|
||||
'We can only find associated exes by extension, so don't show any files that have no extension
|
||||
If IsNothing(extension) Then
|
||||
ListView1.Items.Clear()
|
||||
Dim i = 0
|
||||
For Each row As DataRow In CURRENT_SCAN_TABLE.Rows
|
||||
Dim extension = Path.GetExtension(row.Item("FILENAME2WORK").ToString)
|
||||
Dim filestring = row.Item("FILENAME2WORK")
|
||||
If ClassHelper.CheckFileIsInUse(filestring) = False Then
|
||||
Dim filename = row.Item("FILENAME_ONLY").ToString
|
||||
Dim ID = row.Item("GUID").ToString
|
||||
'We can only find associated exes by extension, so don't show any files that have no extension
|
||||
If IsNothing(extension) Then
|
||||
Else
|
||||
If extension.Contains("pdf") Then
|
||||
'Add the file to the ListView, with the executable path as the key to the ImageList's image
|
||||
ListView1.Items.Add(filename, 0)
|
||||
Else
|
||||
If extension.Contains("pdf") Then
|
||||
'Add the file to the ListView, with the executable path as the key to the ImageList's image
|
||||
ListView1.Items.Add(filename, 0)
|
||||
|
||||
Else
|
||||
ListView1.Items.Add(filename)
|
||||
End If
|
||||
ListView1.Items(i).Tag = ID
|
||||
i += 1
|
||||
ListView1.Items.Add(filename)
|
||||
End If
|
||||
ListView1.Items(i).Tag = ID
|
||||
i += 1
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
If CURRENT_SCAN_TABLE.Rows.Count = 0 Then
|
||||
Me.Close()
|
||||
End If
|
||||
Next
|
||||
If CURRENT_SCAN_TABLE.Rows.Count = 0 Then
|
||||
Me.Close()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("unexpected Error in Load Scanfiles:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
@@ -60,7 +92,7 @@ Public Class frmScanFiles
|
||||
End Sub
|
||||
|
||||
Private Sub btnrefresh_Click(sender As Object, e As EventArgs) Handles btnrefresh.Click
|
||||
Load_Files()
|
||||
Clear_and_Reload_Files()
|
||||
End Sub
|
||||
|
||||
Private Sub PdfViewer1_CurrentPageChanged(sender As Object, e As DevExpress.XtraPdfViewer.PdfCurrentPageChangedEventArgs) Handles PdfViewer1.CurrentPageChanged
|
||||
@@ -80,7 +112,9 @@ Public Class frmScanFiles
|
||||
Dim i1 = i.Text
|
||||
If Not IsNothing(i) Then
|
||||
If i.Text.ToLower.EndsWith("pdf") Then
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
Panel1.Visible = True
|
||||
PdfViewer1.DocumentFilePath = ""
|
||||
Dim docpath = CURRENT_SCAN_FOLDERWATCH & "\" & i.Text
|
||||
PdfViewer1.LoadDocument(docpath)
|
||||
'PdfViewer1.HorizontalScroll.Visible = True
|
||||
@@ -90,6 +124,7 @@ Public Class frmScanFiles
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Me.Cursor = Cursors.Default
|
||||
End Sub
|
||||
|
||||
Private Sub ToolStripDropDownButton1_Click(sender As Object, e As EventArgs) Handles ToolStripDropDownButton1.Click
|
||||
@@ -110,7 +145,9 @@ Public Class frmScanFiles
|
||||
Private Sub ListView1_MouseMove(sender As Object, e As MouseEventArgs) Handles ListView1.MouseMove
|
||||
If MouseIsDown Then
|
||||
'Initiate dragging.
|
||||
PdfViewer1.DocumentFilePath = ""
|
||||
ListView1.DoDragDrop(DragID, DragDropEffects.Copy)
|
||||
|
||||
End If
|
||||
MouseIsDown = False
|
||||
End Sub
|
||||
@@ -123,16 +160,13 @@ Public Class frmScanFiles
|
||||
MouseIsDown = True
|
||||
DragID = i.Tag
|
||||
'Console.WriteLine("Mouse Down")
|
||||
PdfViewer1.DocumentFilePath = ""
|
||||
ListView1.DoDragDrop("SCAN;" & DragID.ToString, DragDropEffects.Copy)
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub ListView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView1.SelectedIndexChanged
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub PdfViewer1_DocumentChanged(sender As Object, e As DevExpress.XtraPdfViewer.PdfDocumentChangedEventArgs) Handles PdfViewer1.DocumentChanged
|
||||
PDF_Pagenumber()
|
||||
End Sub
|
||||
@@ -140,14 +174,20 @@ Public Class frmScanFiles
|
||||
Private Sub btndelete_Click(sender As Object, e As EventArgs) Handles btndelete.Click
|
||||
Try
|
||||
If ListView1.SelectedItems.Count = 1 Then
|
||||
PdfViewer1.DocumentFilePath = ""
|
||||
Dim i = ListView1.FocusedItem
|
||||
Dim i1 = i.Text
|
||||
If Not IsNothing(i) Then
|
||||
Dim del = "DELETE FROM TBPMO_FILES_USER where GUID = " & i.Tag
|
||||
If ClassDatabase.Execute_non_Query(del, True) Then
|
||||
ClassFolderWatcher.Check_Scan_Files()
|
||||
Load_Files()
|
||||
Else
|
||||
MsgBox("Could not delete the entry. Check the logfile!", MsgBoxStyle.Information)
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
MsgBox("Please choose a file!", MsgBoxStyle.Information)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in Delete Scanfile:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
@@ -158,23 +198,30 @@ Public Class frmScanFiles
|
||||
|
||||
Private Sub frmScanFiles_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||
Me.BringToFront()
|
||||
Timer1.Start()
|
||||
TimerCheckScanFiles.Start()
|
||||
End Sub
|
||||
|
||||
Private Sub chkInFront_CheckedChanged(sender As Object, e As EventArgs) Handles chkInFront.CheckedChanged
|
||||
My.Settings.Save()
|
||||
End Sub
|
||||
Private Sub Timer1_Tick_1(sender As Object, e As EventArgs) Handles Timer1.Tick
|
||||
Dim DT As DataTable = ClassFolderWatcher.Check_Scan_Files
|
||||
If DT.Rows.Count <> ListView1.Items.Count Then
|
||||
Private Sub Timer1_Tick_1(sender As Object, e As EventArgs) Handles TimerCheckScanFiles.Tick
|
||||
If CURRENT_SCAN_TABLE.Rows.Count <> ListView1.Items.Count Then
|
||||
'Dim result As MsgBoxResult
|
||||
'Dim msg = "Neue Dateien wurden gescann"
|
||||
'result = MessageBox.Show(msg, "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
'If result = MsgBoxResult.No Then
|
||||
|
||||
'End If
|
||||
Load_Files()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
Dim del = "DELETE FROM TBPMO_FILES_USER where HANDLE_TYPE = 'SCAN' AND UPPER(USER_WORK) = UPPER('" & USER_USERNAME & "')"""
|
||||
PdfViewer1.DocumentFilePath = ""
|
||||
Dim del = "DELETE FROM TBPMO_FILES_USER where HANDLE_TYPE = 'SCAN' AND UPPER(USER_WORK) = UPPER('" & USER_USERNAME & "')"
|
||||
If ClassDatabase.Execute_non_Query(del, True) Then
|
||||
ClassFolderWatcher.Check_Scan_Files()
|
||||
Load_Files()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user