Compare commits
4 Commits
f41710d356
...
4eae3d6e80
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4eae3d6e80 | ||
|
|
acbd5c82be | ||
|
|
a5075cc7f4 | ||
|
|
22cf38d83c |
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.4")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.4")>
|
||||
<Assembly: AssemblyVersion("1.0.0.5")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.5")>
|
||||
|
||||
@@ -194,6 +194,10 @@
|
||||
<Project>{81cac44f-3711-4c8f-ae98-e02a7448782a}</Project>
|
||||
<Name>ZooFlow</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Windows\Windows.vbproj">
|
||||
<Project>{5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86}</Project>
|
||||
<Name>Windows</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
||||
@@ -2,7 +2,5 @@
|
||||
Public Const NO_ROW_HANDLE = -1
|
||||
|
||||
Public Shared ReadOnly MESSAGE_TOO_MANY_SEARCHES = "You have more than three searches configured. This Window will only show the first three result lists!"
|
||||
Public Shared ReadOnly MESSAGE_ERROR_IN_SEARCHES = $"An error occurred while executing searches or no searches were found!{vbNewLine}
|
||||
Please check the SQL Queries for errors and if the correct connection was configured.{vbNewLine}{vbNewLine}
|
||||
For more information check the Logfile."
|
||||
Public Shared ReadOnly MESSAGE_ERROR_IN_SEARCHES = $"An error occurred while executing searches or no searches were found!{vbNewLine}Please check the SQL Queries for errors and if the correct connection was configured.{vbNewLine}{vbNewLine}For more information check the Logfile."
|
||||
End Class
|
||||
|
||||
@@ -1,29 +1,61 @@
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Windows.Forms
|
||||
Imports DevExpress.Utils.Menu
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Windows.NativeMethods
|
||||
Imports DigitalData.Modules.Windows.File
|
||||
Imports DigitalData.Modules.ZooFlow
|
||||
|
||||
Public Class DocumentPropertyMenu
|
||||
Private ReadOnly _Logger As Logger
|
||||
Private ReadOnly _LogConfig As LogConfig
|
||||
Private ReadOnly _Environment As Environment
|
||||
Private ReadOnly _File As Modules.Windows.File
|
||||
|
||||
Private ReadOnly _FilePath As String
|
||||
Private ReadOnly _ObjectId As Long
|
||||
|
||||
Public Const OPEN_FILE As String = "Datei öffnen"
|
||||
Public Const OPEN_DIRECTORY As String = "Ordner öffnen"
|
||||
Public Const COPY_PATH As String = "Dateipfad kopieren"
|
||||
Public Const OPEN_PROPERTIES As String = "Eigenschaften"
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Environment As Environment, FilePath As String, Optional ObjectId As Long = 0)
|
||||
_LogConfig = LogConfig
|
||||
_Logger = LogConfig.GetLogger()
|
||||
_Environment = Environment
|
||||
_FilePath = FilePath
|
||||
_ObjectId = ObjectId
|
||||
_File = New Modules.Windows.File(LogConfig)
|
||||
End Sub
|
||||
|
||||
Public Function GetMenuItems() As List(Of DXMenuItem)
|
||||
Dim oOpenFile = New DXMenuItem("Datei öffnen", AddressOf OpenFile_Click)
|
||||
Dim oOpenFolder = New DXMenuItem("Ordner öffnen", AddressOf OpenFolder_Click)
|
||||
Dim oCopyPath = New DXMenuItem("Pfad kopieren", AddressOf CopyPath_Click)
|
||||
Dim oProperties = New DXMenuItem("Eigenschaften", AddressOf Properties_Click)
|
||||
Public Function GetMenuItems(IsLegacy As Boolean) As List(Of DXMenuItem)
|
||||
If IsLegacy Then
|
||||
Return GetLegacyMenuItems()
|
||||
Else
|
||||
Return GetIDBMenuItems()
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function GetIDBMenuItems() As List(Of DXMenuItem)
|
||||
Dim oOpenFile = New DXMenuItem(OPEN_FILE, AddressOf OpenFile_Click)
|
||||
Dim oOpenFolder = New DXMenuItem(OPEN_DIRECTORY, AddressOf OpenFolder_Click)
|
||||
Dim oCopyPath = New DXMenuItem(COPY_PATH, AddressOf CopyPath_Click)
|
||||
Dim oProperties = New DXMenuItem(OPEN_PROPERTIES, AddressOf Properties_Click)
|
||||
|
||||
Return New List(Of DXMenuItem) From {
|
||||
oOpenFile,
|
||||
oOpenFolder,
|
||||
oCopyPath,
|
||||
oProperties
|
||||
}
|
||||
End Function
|
||||
|
||||
Public Function GetLegacyMenuItems() As List(Of DXMenuItem)
|
||||
Dim oOpenFile = New DXMenuItem(OPEN_FILE, AddressOf OpenFile_Click)
|
||||
Dim oOpenFolder = New DXMenuItem(OPEN_DIRECTORY, AddressOf OpenFolder_Click)
|
||||
Dim oCopyPath = New DXMenuItem(COPY_PATH, AddressOf CopyPath_Click)
|
||||
Dim oProperties = New DXMenuItem(OPEN_PROPERTIES, AddressOf Properties_Click_Legacy)
|
||||
|
||||
Return New List(Of DXMenuItem) From {
|
||||
oOpenFile,
|
||||
@@ -34,7 +66,7 @@ Public Class DocumentPropertyMenu
|
||||
End Function
|
||||
|
||||
Public Sub Properties_Click(sender As Object, e As EventArgs)
|
||||
If _ObjectId = 0 Then
|
||||
If TestObjectIdExists(OPEN_PROPERTIES) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@@ -42,28 +74,50 @@ Public Class DocumentPropertyMenu
|
||||
oPropertyDialog.Show()
|
||||
End Sub
|
||||
|
||||
Public Sub CopyPath_Click(sender As Object, e As EventArgs)
|
||||
If IO.File.Exists(_FilePath) Then
|
||||
Clipboard.SetText(_FilePath)
|
||||
Else
|
||||
MessageBox.Show($"Datei {_FilePath} existiert nicht oder wurde verschoben!", "Dateipfad kopieren", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
||||
Public Sub Properties_Click_Legacy(sender As Object, e As EventArgs)
|
||||
If TestPathExists(OPEN_PROPERTIES) = False Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
_File.OpenFileProperties(_FilePath)
|
||||
End Sub
|
||||
|
||||
Public Sub CopyPath_Click(sender As Object, e As EventArgs)
|
||||
Clipboard.SetText(_FilePath)
|
||||
End Sub
|
||||
|
||||
Public Sub OpenFile_Click(sender As Object, e As EventArgs)
|
||||
If IO.File.Exists(_FilePath) Then
|
||||
Process.Start(_FilePath)
|
||||
Else
|
||||
MessageBox.Show($"Datei {_FilePath} existiert nicht oder wurde verschoben!", "Datei öffnen", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
||||
If TestPathExists(OPEN_FILE) = False Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Process.Start(_FilePath)
|
||||
End Sub
|
||||
|
||||
Public Sub OpenFolder_Click(sender As Object, e As EventArgs)
|
||||
If IO.File.Exists(_FilePath) Then
|
||||
Dim oDirectory = IO.Path.GetDirectoryName(_FilePath)
|
||||
Process.Start(oDirectory)
|
||||
Else
|
||||
MessageBox.Show($"Datei {_FilePath} existiert nicht oder wurde verschoben!", "Ordner öffnen", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
||||
If TestPathExists(OPEN_DIRECTORY) = False Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oDirectory = IO.Path.GetDirectoryName(_FilePath)
|
||||
Process.Start(oDirectory)
|
||||
End Sub
|
||||
|
||||
Private Function TestPathExists(Title As String) As Boolean
|
||||
If IO.File.Exists(_FilePath) = False Then
|
||||
MessageBox.Show($"Datei {_FilePath} existiert nicht oder wurde verschoben!", Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function TestObjectIdExists(Title As String) As Boolean
|
||||
If _ObjectId = 0 Then
|
||||
MessageBox.Show($"Objekt {_ObjectId} existiert nicht oder wurde verschoben!", Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@@ -598,7 +598,7 @@ Public Class frmDocumentResultList
|
||||
|
||||
e.Menu.Items.Clear()
|
||||
|
||||
For Each oItem In oMenu.GetMenuItems()
|
||||
For Each oItem In oMenu.GetMenuItems(_IsLegacy)
|
||||
e.Menu.Items.Add(oItem)
|
||||
Next
|
||||
End If
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.2")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.2")>
|
||||
<Assembly: AssemblyVersion("1.0.0.3")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.3")>
|
||||
|
||||
36
Windows/File.vb
Normal file
36
Windows/File.vb
Normal file
@@ -0,0 +1,36 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Windows.NativeMethods
|
||||
|
||||
Public Class File
|
||||
Private _LogConfig As LogConfig
|
||||
Private _Logger As Logger
|
||||
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
_LogConfig = LogConfig
|
||||
_Logger = LogConfig.GetLogger()
|
||||
End Sub
|
||||
|
||||
Public Function OpenFileProperties(FilePath As String) As Boolean
|
||||
Try
|
||||
Dim oShellExecuteInfo As New ShellExecuteInfo()
|
||||
oShellExecuteInfo.cbSize = Marshal.SizeOf(oShellExecuteInfo)
|
||||
oShellExecuteInfo.lpVerb = "properties"
|
||||
oShellExecuteInfo.lpFile = FilePath
|
||||
oShellExecuteInfo.nShow = SW_SHOW
|
||||
oShellExecuteInfo.fMask = SEE_MASK_INVOKEIDLIST
|
||||
|
||||
If Not ShellExecuteEx(oShellExecuteInfo) Then
|
||||
Dim oWin32Error = Marshal.GetLastWin32Error()
|
||||
Dim oException As New Win32Exception(oWin32Error)
|
||||
Throw oException
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
@@ -5,6 +5,9 @@ Public Class NativeMethods
|
||||
Public Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" (ByVal hwnd As Int32) As Integer
|
||||
Public Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hWnd As IntPtr, ByVal WinTitle As String, ByVal MaxLength As Integer) As Integer
|
||||
|
||||
<DllImport("Shell32", CharSet:=CharSet.Auto, SetLastError:=True)>
|
||||
Public Shared Function ShellExecuteEx(ByRef lpExecInfo As ShellExecuteInfo) As Boolean
|
||||
End Function
|
||||
<DllImport("user32.dll")>
|
||||
Public Shared Function GetDC(ByVal hwnd As IntPtr) As IntPtr
|
||||
End Function
|
||||
@@ -97,6 +100,10 @@ Public Class NativeMethods
|
||||
Public Const MEM_MAPPED As Integer = &H40000
|
||||
Public Const MEM_TOP_DOWN As Integer = &H100000
|
||||
Public Const INVALID_HANDLE_VALUE As Integer = -1
|
||||
Public Const SW_SHOW As Short = 5
|
||||
Public Const SEE_MASK_INVOKEIDLIST = &HC
|
||||
Public Const SEE_MASK_NOCLOSEPROCESS = &H40
|
||||
Public Const SEE_MASK_FLAG_NO_UI = &H400
|
||||
|
||||
Public Enum PageProtection As UInteger
|
||||
NoAccess = &H1
|
||||
@@ -130,6 +137,24 @@ Public Class NativeMethods
|
||||
End Function
|
||||
End Structure
|
||||
|
||||
Public Structure ShellExecuteInfo
|
||||
Public cbSize As Integer
|
||||
Public fMask As Integer
|
||||
Public hwnd As IntPtr
|
||||
<MarshalAs(UnmanagedType.LPTStr)> Public lpVerb As String
|
||||
<MarshalAs(UnmanagedType.LPTStr)> Public lpFile As String
|
||||
<MarshalAs(UnmanagedType.LPTStr)> Public lpParameters As String
|
||||
<MarshalAs(UnmanagedType.LPTStr)> Public lpDirectory As String
|
||||
Dim nShow As Integer
|
||||
Dim hInstApp As IntPtr
|
||||
Dim lpIDList As IntPtr
|
||||
<MarshalAs(UnmanagedType.LPTStr)> Public lpClass As String
|
||||
Public hkeyClass As IntPtr
|
||||
Public dwHotKey As Integer
|
||||
Public hIcon As IntPtr
|
||||
Public hProcess As IntPtr
|
||||
End Structure
|
||||
|
||||
<System.Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)>
|
||||
Public Structure PointAPI
|
||||
Public X As Integer
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Drawing.vb" />
|
||||
<Compile Include="File.vb" />
|
||||
<Compile Include="NativeMethods.vb" />
|
||||
<Compile Include="Utils.vb" />
|
||||
<Compile Include="Window.vb" />
|
||||
|
||||
Reference in New Issue
Block a user