diff --git a/Global_Indexer/ClassFilehandle.vb b/Global_Indexer/ClassFilehandle.vb index ad2b896..1b56704 100644 --- a/Global_Indexer/ClassFilehandle.vb +++ b/Global_Indexer/ClassFilehandle.vb @@ -1,5 +1,6 @@ Imports System.IO Imports System.Text.RegularExpressions +Imports DevExpress.XtraEditors Imports Independentsoft Public Class ClassFilehandle @@ -16,31 +17,40 @@ Public Class ClassFilehandle Dim r = New Regex(String.Format("[{0}]", Regex.Escape(regexSearch))) Return r.Replace(Input, replacement) End Function - Public Shared Function Decide_FileHandle(filename As String, handletype As String) + Public Shared Function Decide_FileHandle(pFilename As String, pHandletype As String) Try - If filename.EndsWith(".msg") Then + If pFilename.EndsWith(".msg") Then CURRENT_MESSAGEID = "" - Dim _msg As New Msg.Message(filename) - If _msg.Attachments.Count > 0 Then - Dim result As MsgBoxResult + Dim oMsg As New Msg.Message(pFilename) + If oMsg.Attachments.Count > 0 Then + + Dim oTitle As String + Dim oMessage As String If USER_LANGUAGE = "de-DE" Then - result = MessageBox.Show(New Form With {.TopMost = True}, "Achtung: Die Email enthält Anhänge!" & vbNewLine & "Wollen Sie die Anhänge separat indexieren und herauslösen?", "Nachfrage zur Indexierung:", MessageBoxButtons.YesNo, MessageBoxIcon.Question) + oTitle = "Nachfrage zur Indexierung:" + oMessage = "Achtung: Die Email enthält Anhänge!" & vbNewLine & "Wollen Sie die Anhänge separat indexieren und herauslösen?" Else - result = MessageBox.Show(New Form With {.TopMost = True}, "Attention: This Email contains Attachments!" & vbNewLine & "Do you want to extract the attachments and index them seperately?", "Question about Indexing:", MessageBoxButtons.YesNo, MessageBoxIcon.Question) + oTitle = "Question about Indexing:" + oMessage = "Attention: This Email contains Attachments!" & vbNewLine & "Do you want to extract the attachments and index them seperately?" End If + Dim oResult As DialogResult - If result = MsgBoxResult.Yes Then - If handletype.StartsWith("|FW") Then - Return Email_Decay(filename, True) + ' Weird hack to force messagebox to be topmost + ' https://stackoverflow.com/questions/1220882/keep-messagebox-show-on-top-of-other-application-using-c-sharp + oResult = MessageBox.Show(oMessage, oTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly) + + If oResult = MsgBoxResult.Yes Then + If pHandletype.StartsWith("|FW") Then + Return Email_Decay(pFilename, True) Else - Return Email_Decay(filename) + Return Email_Decay(pFilename) End If End If End If End If - If filename.ToUpper.EndsWith(".LNK") Then + If pFilename.ToUpper.EndsWith(".LNK") Then If USER_LANGUAGE = "de-DE" Then MsgBox("Verknüpfungen können nicht abgelegt werden!", MsgBoxStyle.Critical, "Global Indexer") Else @@ -49,7 +59,7 @@ Public Class ClassFilehandle Return False End If - Return Insert_GI_File(filename, handletype) + Return Insert_GI_File(pFilename, pHandletype) Catch ex As Exception MsgBox("Unexpected Error in Decide_FileHandle: " & ex.Message, MsgBoxStyle.Critical) Return False