sdflh
This commit is contained in:
parent
0ec5829275
commit
f3a3812993
26
Automation/Form1.Designer.vb
generated
26
Automation/Form1.Designer.vb
generated
@ -39,13 +39,13 @@ Partial Class Form1
|
||||
Me.TextBox8 = New System.Windows.Forms.TextBox()
|
||||
Me.ComboBox1 = New System.Windows.Forms.ComboBox()
|
||||
Me.Label1 = New System.Windows.Forms.Label()
|
||||
Me.TextBox3 = New System.Windows.Forms.TextBox()
|
||||
Me.Label3 = New System.Windows.Forms.Label()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'Timer1
|
||||
'
|
||||
'
|
||||
'TextBox1
|
||||
'
|
||||
Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!)
|
||||
Me.TextBox1.Location = New System.Drawing.Point(12, 12)
|
||||
Me.TextBox1.Name = "TextBox1"
|
||||
Me.TextBox1.Size = New System.Drawing.Size(100, 20)
|
||||
@ -170,6 +170,22 @@ Partial Class Form1
|
||||
Me.Label1.TabIndex = 8
|
||||
Me.Label1.Text = "Anchor"
|
||||
'
|
||||
'TextBox3
|
||||
'
|
||||
Me.TextBox3.Location = New System.Drawing.Point(231, 206)
|
||||
Me.TextBox3.Name = "TextBox3"
|
||||
Me.TextBox3.Size = New System.Drawing.Size(100, 20)
|
||||
Me.TextBox3.TabIndex = 2
|
||||
'
|
||||
'Label3
|
||||
'
|
||||
Me.Label3.AutoSize = True
|
||||
Me.Label3.Location = New System.Drawing.Point(183, 209)
|
||||
Me.Label3.Name = "Label3"
|
||||
Me.Label3.Size = New System.Drawing.Size(41, 13)
|
||||
Me.Label3.TabIndex = 6
|
||||
Me.Label3.Text = "Anchor"
|
||||
'
|
||||
'Form1
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
@ -180,9 +196,11 @@ Partial Class Form1
|
||||
Me.Controls.Add(Me.Label21)
|
||||
Me.Controls.Add(Me.Label7)
|
||||
Me.Controls.Add(Me.Label6)
|
||||
Me.Controls.Add(Me.Label3)
|
||||
Me.Controls.Add(Me.Label5)
|
||||
Me.Controls.Add(Me.Label4)
|
||||
Me.Controls.Add(Me.TextBox12)
|
||||
Me.Controls.Add(Me.TextBox3)
|
||||
Me.Controls.Add(Me.TextBox11)
|
||||
Me.Controls.Add(Me.TextBox10)
|
||||
Me.Controls.Add(Me.TextBox9)
|
||||
@ -212,4 +230,6 @@ Partial Class Form1
|
||||
Friend WithEvents TextBox8 As TextBox
|
||||
Friend WithEvents ComboBox1 As ComboBox
|
||||
Friend WithEvents Label1 As Label
|
||||
Friend WithEvents TextBox3 As TextBox
|
||||
Friend WithEvents Label3 As Label
|
||||
End Class
|
||||
|
||||
@ -24,12 +24,13 @@ Public Class Form1
|
||||
End Sub
|
||||
|
||||
Private Sub Watcher_ClipboardChanged(sender As Object, e As IDataObject)
|
||||
Dim oControl As Window.RectangleInfo = Window.GetFocusedControlLocation(CurrentAnchor)
|
||||
Dim oControl As Window.RectangleInfo = Window.GetFocusedControlLocation(Handle, CurrentAnchor)
|
||||
|
||||
TextBox9.Text = oControl.Left
|
||||
TextBox12.Text = oControl.Right
|
||||
TextBox11.Text = oControl.Top
|
||||
TextBox10.Text = oControl.Bottom
|
||||
TextBox3.Text = ComboBox1.Text.ToUpper
|
||||
End Sub
|
||||
|
||||
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
|
||||
|
||||
@ -48,6 +48,9 @@ Public Class Form1
|
||||
|
||||
Case ZUGFERD_REJECTED_EML
|
||||
args.RejectedEmailDirectory = row.Item("FOLDER_PATH")
|
||||
|
||||
Case ZUGFERD_ATTACHMENTS
|
||||
args.AttachmentsSubDirectory = row.Item("FOLDER_PATH")
|
||||
End Select
|
||||
Next
|
||||
|
||||
|
||||
@ -97,6 +97,23 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oSource = GetOriginalEmailPath(Args.OriginalEmailDirectory, MessageId)
|
||||
Dim oDestination = GetEmailPathWithSubjectAsName(Args.RejectedEmailDirectory, oEmailData.Subject)
|
||||
|
||||
Dim oVersion As Integer = 0
|
||||
Dim oFileName As String = oDestination
|
||||
|
||||
Do While File.Exists(oFileName)
|
||||
If oVersion > 29 Then
|
||||
Throw New ApplicationException("Max. Move-Retries of 30 exceeded! Move will be aborted!")
|
||||
End If
|
||||
|
||||
oVersion += 1
|
||||
|
||||
Dim oDestinationDir = Path.GetDirectoryName(oDestination)
|
||||
Dim oExtension = Path.GetExtension(oFileName)
|
||||
Dim oRootName = Path.GetFileNameWithoutExtension(oFileName)
|
||||
Dim oNewName As String = oRootName & "~" & oVersion & oExtension
|
||||
oFileName = Path.Combine(oDestinationDir, oNewName)
|
||||
Loop
|
||||
|
||||
Try
|
||||
File.Move(oSource, oDestination)
|
||||
oEmailData.Attachment = oDestination
|
||||
|
||||
@ -163,18 +163,42 @@ Public Class Window
|
||||
''' <summary>
|
||||
''' Returns Bounds of the focused control. Relative to current form and `Anchor` value.
|
||||
''' </summary>
|
||||
Public Function GetFocusedControlLocation(Optional Anchor As Anchor = Anchor.TopLeft) As RectangleInfo
|
||||
Public Function GetFocusedControlLocation(WindowHandle As IntPtr, Anchor As Anchor) As RectangleInfo
|
||||
Dim oWindowRect As New NativeMethods.RectangleAPI
|
||||
Dim oControlRect As New NativeMethods.RectangleAPI
|
||||
Dim oForegroundWindow As IntPtr
|
||||
Dim oFocusedControl As IntPtr
|
||||
Dim oForegroundWindow As WindowInfo
|
||||
Dim oFocusedControl As WindowInfo
|
||||
Dim oResult As New RectangleInfo
|
||||
|
||||
Try
|
||||
oForegroundWindow = NativeMethods.GetForegroundWindow()
|
||||
oFocusedControl = NativeMethods.GetFocus()
|
||||
oForegroundWindow = GetWindowInfo()
|
||||
oFocusedControl = GetFocusedControl(WindowHandle)
|
||||
|
||||
Return GetControlLocation(oFocusedControl, oForegroundWindow, Anchor)
|
||||
Return GetControlLocation(oFocusedControl.hWnd, oForegroundWindow.hWnd, Anchor)
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetFocusedControlLocation(WindowHandle As IntPtr) As Dictionary(Of String, RectangleInfo)
|
||||
Dim oWindowRect As New NativeMethods.RectangleAPI
|
||||
Dim oControlRect As New NativeMethods.RectangleAPI
|
||||
Dim oForegroundWindow As WindowInfo
|
||||
Dim oFocusedControl As WindowInfo
|
||||
Dim oResult As New RectangleInfo
|
||||
|
||||
Try
|
||||
oForegroundWindow = GetWindowInfo()
|
||||
oFocusedControl = GetFocusedControl(WindowHandle)
|
||||
|
||||
Dim oDict As New Dictionary(Of String, RectangleInfo)
|
||||
|
||||
For Each oAnchor As Anchor In [Enum].GetValues(GetType(Anchor))
|
||||
oDict.Add(oAnchor.ToString.ToUpper, GetControlLocation(oFocusedControl.hWnd, oForegroundWindow.hWnd, oAnchor))
|
||||
Next
|
||||
|
||||
Return oDict
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Return Nothing
|
||||
|
||||
@ -271,6 +271,7 @@ Public Class ClassProfileFilter
|
||||
|
||||
Return oProfiles
|
||||
End Function
|
||||
|
||||
Public Function FilterProfilesByFocusedControl(Profiles As List(Of ProfileData), ClipboardContents As String, ControlFocusresult As String) As List(Of ProfileData)
|
||||
Dim oWindow As Window.WindowInfo
|
||||
Dim oFocusedControl As Window.WindowInfo
|
||||
|
||||
@ -88,6 +88,13 @@ Partial Public Class frmMain
|
||||
Dim oMatchingProfiles As List(Of ProfileData)
|
||||
Dim oWindow As New Window(My.LogConfig)
|
||||
Dim oWindowInfo = oWindow.GetWindowInfo()
|
||||
|
||||
Dim oControls As New Dictionary(Of String, Window.RectangleInfo) From {
|
||||
{"TOPLEFT", New Window.RectangleInfo() With {.Left = 20, .Top = 43}}
|
||||
}
|
||||
|
||||
Dim oControl = oWindow.GetFocusedControlLocation(Handle, Window.Anchor.TopLeft)
|
||||
|
||||
Dim oFocusedControl As Window.WindowInfo = oWindow.GetFocusedControl(Handle)
|
||||
Dim oClipboardContents As String = Clipboard.GetText()
|
||||
|
||||
@ -106,7 +113,8 @@ Partial Public Class frmMain
|
||||
Logger.Debug("Profiles after FilterProfilesByProcess: {0}", oMatchingProfiles.Count)
|
||||
oMatchingProfiles = oProfileFilter.FilterWindowsByWindowTitleRegex(oMatchingProfiles, oWindowInfo.WindowTitle)
|
||||
Logger.Debug("Profiles after FilterWindowsByWindowTitleRegex: {0}", oMatchingProfiles.Count)
|
||||
oMatchingProfiles = oProfileFilter.FilterProfilesByFocusedControl(oMatchingProfiles, oClipboardContents, oFocusedControl.hWnd.ToString)
|
||||
'oMatchingProfiles = oProfileFilter.FilterProfilesByFocusedControl(oMatchingProfiles, oClipboardContents, oFocusedControl.hWnd.ToString)
|
||||
oMatchingProfiles = oProfileFilter.FilterProfilesByFocusedControlLocation(oMatchingProfiles, oClipboardContents)
|
||||
Logger.Debug("Profiles after FilterProfilesByFocusedControl: {0}", oMatchingProfiles.Count)
|
||||
oMatchingProfiles = Await Task.Run(Function() oProfileFilter.FilterProfilesBySearchResults(oMatchingProfiles))
|
||||
Logger.Debug("Profiles after FilterProfilesBySearchResults: {0}", oMatchingProfiles.Count)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user