Include new Messagebox for important messages

This commit is contained in:
Jonathan Jenne 2022-06-07 11:17:13 +02:00
parent 271a3d1157
commit 97a2f6815c
5 changed files with 31 additions and 12 deletions

View File

@ -1,4 +1,5 @@
Imports System.IO
Imports DigitalData.GUIs.Common
Public Class ClassIndexFunctions
Public Shared Function FileExistsinDropTable(pFilename As String, pHandleType As String) As Date
@ -56,8 +57,9 @@ Public Class ClassIndexFunctions
End Try
End Function
Public Shared Function CheckDuplicateFiles(pFilepath As String, pModuleTitle As String, Optional pHandleType As String = "")
Public Shared Function CheckDuplicateFiles(pForm As Form, pFilepath As String, pModuleTitle As String, Optional pHandleType As String = "")
Dim oFileInfo As New FileInfo(pFilepath)
Dim oFormHelper As New FormHelper(LOGCONFIG, pForm)
Dim oFilename As String = oFileInfo.Name
Dim oFileExists As Date = FileExistsinDropTable(pFilepath, pHandleType)
@ -70,12 +72,14 @@ Public Class ClassIndexFunctions
Dim oMessage As String
If USER_LANGUAGE = "de-DE" Then
oMessage = $"Die Datei [{oFilename}] wurde bereits am [{oDate}] verarbeitet. Wollen Sie die gleiche Datei noch einmal verarbeiten?"
oMessage = $"Die Datei [{oFilename}] wurde bereits am [{oDate}] verarbeitet.{vbNewLine}{vbNewLine}Wollen Sie die gleiche Datei noch einmal verarbeiten?"
Else
oMessage = $"The file [{oFilename}] has already been processed at [{oDate}]. Do you want to process the same file again?"
oMessage = $"The file [{oFilename}] has already been processed at [{oDate}].{vbNewLine}{vbNewLine}Do you want to process the same file again?"
End If
oResult = MessageBox.Show(oMessage, oBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
oResult = oFormHelper.ShowQuestionMessage(oMessage, oBoxTitle)
'oResult = MessageBox.Show(oMessage, oBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
If oResult = DialogResult.Yes Then
Return True

View File

@ -7,6 +7,12 @@ Imports DigitalData.Modules.Messaging
Imports DigitalData.Modules.Database
Imports DLLLicenseManager
Public Class ClassInit
Private Form As Form
Public Sub New(pForm As Form)
Form = pForm
End Sub
Public Sub InitLogger()
LOGCONFIG = New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing,
CompanyName:=My.Application.Info.CompanyName,
@ -218,7 +224,7 @@ Public Class ClassInit
'Die Datei übergeben
LOGGER.Info(">> OnCreated-File:" & e.FullPath)
If ClassIndexFunctions.CheckDuplicateFiles(e.FullPath, "FolderWatch/Scan") Then
If ClassIndexFunctions.CheckDuplicateFiles(Form, e.FullPath, "FolderWatch/Scan") Then
FILE_HANDLER.Decide_FileHandle(e.FullPath, oHandleType)
End If
Catch ex As Exception

View File

@ -12,6 +12,7 @@ Imports DevExpress.XtraEditors.Controls
Imports Limilabs.Mail
Imports Limilabs.Mail.Headers
Imports DevExpress.XtraEditors
Imports DigitalData.GUIs.Common
Public Class frmIndex
#Region "+++++ Variablen ++++++"
@ -47,6 +48,7 @@ Public Class frmIndex
Private Property DocTypes As New List(Of DocType)
Private ReadOnly _Logger As Logger
Private ReadOnly _FormHelper As FormHelper
#End Region
@ -80,6 +82,7 @@ Public Class frmIndex
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
_Logger = LOGCONFIG.GetLogger()
_FormHelper = New FormHelper(LOGCONFIG, Me)
Localizer.Active = New LookupGridLocalizer()
End Sub
@ -2812,10 +2815,14 @@ Public Class frmIndex
Me.Cursor = Cursors.Default
If CONFIG.Config.ShowIndexResult = True Then
If USER_LANGUAGE = LANG_DE Then
MsgBox("Die Datei wurde erfolgreich verarbeitet!" & vbNewLine & "Ablagepfad:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Erfolgsmeldung")
' MsgBox("Die Datei wurde erfolgreich verarbeitet!" & vbNewLine & "Ablagepfad:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Erfolgsmeldung")
_FormHelper.ShowSuccessMessage($"Die Datei wurde erfolgreich verarbeitet!{vbNewLine}Ablagepfad:{vbNewLine}{CURRENT_NEWFILENAME}", "Erfolgsmeldung")
Else
MsgBox("File sucessfully processed!" & vbNewLine & "Path:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Success")
'MsgBox($"File sucessfully processed!{vbNewLine}Path:{vbNewLine}{CURRENT_NEWFILENAME}" & vbNewLine & "Path:" & vbNewLine & CURRENT_NEWFILENAME, MsgBoxStyle.Information, "Success")
_FormHelper.ShowSuccessMessage($"File sucessfully processed!{vbNewLine}Path:{vbNewLine}{CURRENT_NEWFILENAME}", "Success")
End If
End If
CloseViewer()

View File

@ -50,7 +50,7 @@ Public NotInheritable Class frmSplash
<STAThread()> _
Private Sub bw_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs)
Dim Init = New ClassInit()
Dim Init = New ClassInit(Me)
bw.ReportProgress(CalcProgress(1), "Initialize Logging")
Init.InitLogger()

View File

@ -7,6 +7,7 @@ Imports System.Runtime.InteropServices
Imports DigitalData.Modules.Language
Imports DigitalData.Modules.Windows
Imports DigitalData.Modules.License
Imports DigitalData.GUIs.Common
Public Class frmStart
Public LicenseManager As LicenseManagerLegacy
@ -16,6 +17,7 @@ Public Class frmStart
Private FileDrop As FileDrop
Private DroppedFiles As List(Of FileDrop.DroppedFile)
Private FormHelper As FormHelper
'Private DroppedFiles As List(Of FileDrop.DroppedFile)
@ -37,7 +39,7 @@ Public Class frmStart
InitializeComponent()
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
FormHelper = New FormHelper(LOGCONFIG, Me)
End Sub
#Region "=== FORM EVENTS ==="
@ -212,7 +214,7 @@ Public Class frmStart
Dim oDropType = oDroppedFile.DropType
Dim oFileName = oDroppedFile.FilePath
If ClassIndexFunctions.CheckDuplicateFiles(oFileName, "Manuelle Ablage", oDropType) Then
If ClassIndexFunctions.CheckDuplicateFiles(Me, oFileName, "Manuelle Ablage", oDropType) Then
FILE_HANDLER.Decide_FileHandle(oFileName, oDropType)
End If
Next
@ -418,7 +420,7 @@ Public Class frmStart
'Die Datei übergeben
LOGGER.Info(">> Adding file from Scanfolder after startup:" & oFileName)
If ClassIndexFunctions.CheckDuplicateFiles(oFileName, "FolderWatch/Scan") Then
If ClassIndexFunctions.CheckDuplicateFiles(Me, oFileName, "FolderWatch/Scan") Then
FILE_HANDLER.Decide_FileHandle(oFileName, oHandleType)
End If
Next oFileName
@ -454,7 +456,7 @@ Public Class frmStart
'Die Datei übergeben
LOGGER.Info(">> Adding file from Folderwatch after startup:" & oFileName)
If ClassIndexFunctions.CheckDuplicateFiles(oFileName, "FolderWatch/Scan") Then
If ClassIndexFunctions.CheckDuplicateFiles(Me, oFileName, "FolderWatch/Scan") Then
FILE_HANDLER.Decide_FileHandle(oFileName, handleType)
End If
Next oFileName