From 97a2f6815cc16ed317140f9938eaa40ebfa13f48 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 7 Jun 2022 11:17:13 +0200 Subject: [PATCH] Include new Messagebox for important messages --- Global_Indexer/ClassIndexFunctions.vb | 12 ++++++++---- Global_Indexer/ClassInit.vb | 8 +++++++- Global_Indexer/frmIndex.vb | 11 +++++++++-- Global_Indexer/frmSplash.vb | 2 +- Global_Indexer/frmStart.vb | 10 ++++++---- 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Global_Indexer/ClassIndexFunctions.vb b/Global_Indexer/ClassIndexFunctions.vb index 3287a57..351ea62 100644 --- a/Global_Indexer/ClassIndexFunctions.vb +++ b/Global_Indexer/ClassIndexFunctions.vb @@ -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 diff --git a/Global_Indexer/ClassInit.vb b/Global_Indexer/ClassInit.vb index 530eb67..984a151 100644 --- a/Global_Indexer/ClassInit.vb +++ b/Global_Indexer/ClassInit.vb @@ -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 diff --git a/Global_Indexer/frmIndex.vb b/Global_Indexer/frmIndex.vb index 25dd12f..16617fb 100644 --- a/Global_Indexer/frmIndex.vb +++ b/Global_Indexer/frmIndex.vb @@ -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() diff --git a/Global_Indexer/frmSplash.vb b/Global_Indexer/frmSplash.vb index e5ce358..0363f0f 100644 --- a/Global_Indexer/frmSplash.vb +++ b/Global_Indexer/frmSplash.vb @@ -50,7 +50,7 @@ Public NotInheritable Class frmSplash _ 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() diff --git a/Global_Indexer/frmStart.vb b/Global_Indexer/frmStart.vb index 5bbb0c8..3b0a134 100644 --- a/Global_Indexer/frmStart.vb +++ b/Global_Indexer/frmStart.vb @@ -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