Compare commits
4 Commits
8239883b47
...
130c095056
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
130c095056 | ||
|
|
0023ca3ab7 | ||
|
|
427a8496ce | ||
|
|
660231325c |
@@ -84,6 +84,7 @@ Public Class ProfileFilter
|
|||||||
Dim oMatch = oRegex.Match(ClipboardContents)
|
Dim oMatch = oRegex.Match(ClipboardContents)
|
||||||
If oMatch.Success Then
|
If oMatch.Success Then
|
||||||
_Logger.Debug("FilterProfilesByClipboardRegex: Clipboard Regex Matched: {0}", ClipboardContents)
|
_Logger.Debug("FilterProfilesByClipboardRegex: Clipboard Regex Matched: {0}", ClipboardContents)
|
||||||
|
_Logger.Info("Profile {0} matched!", oProfile.Name)
|
||||||
oFilteredProfiles.Add(oProfile)
|
oFilteredProfiles.Add(oProfile)
|
||||||
oProfile.IsMatched = True
|
oProfile.IsMatched = True
|
||||||
|
|
||||||
@@ -104,10 +105,6 @@ Public Class ProfileFilter
|
|||||||
For Each oProfile In Profiles
|
For Each oProfile In Profiles
|
||||||
Dim oGuid = oProfile.Guid
|
Dim oGuid = oProfile.Guid
|
||||||
|
|
||||||
If oProfile.IsMatched = False Then
|
|
||||||
Continue For
|
|
||||||
End If
|
|
||||||
|
|
||||||
Dim oProcesses As New List(Of ProcessData)
|
Dim oProcesses As New List(Of ProcessData)
|
||||||
For Each oProcessDef As ProcessData In oProfile.Processes
|
For Each oProcessDef As ProcessData In oProfile.Processes
|
||||||
If oProcessDef.PROFILE_ID <> oGuid Then
|
If oProcessDef.PROFILE_ID <> oGuid Then
|
||||||
@@ -121,11 +118,13 @@ Public Class ProfileFilter
|
|||||||
oParent.Nodes.Add(oNode)
|
oParent.Nodes.Add(oNode)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
_Logger.Debug($"FilterProfilesByProcess: Checking Profile: {oProfile.Name} ...")
|
_Logger.Debug($"FilterProfilesByProcess: Checking Profile: {oProfile.Name}")
|
||||||
If oIsMatch Then
|
If oIsMatch Then
|
||||||
_Logger.Debug($"Yes...Processname Matched: {oProcessDef.ProcessName}")
|
_Logger.Debug($"Processname Matched: {oProcessDef.ProcessName}")
|
||||||
'TODO: Add Debug Data
|
|
||||||
oFilteredProfiles.Add(oProfile)
|
oFilteredProfiles.Add(oProfile)
|
||||||
|
_Logger.Info("Profile {0} matched!", oProfile.Name)
|
||||||
|
|
||||||
oProfile.MatchedProcessID = oProcessDef.Guid
|
oProfile.MatchedProcessID = oProcessDef.Guid
|
||||||
oProcessDef.IsMatched = True
|
oProcessDef.IsMatched = True
|
||||||
oProcesses.Add(oProcessDef)
|
oProcesses.Add(oProcessDef)
|
||||||
@@ -151,9 +150,16 @@ Public Class ProfileFilter
|
|||||||
|
|
||||||
For Each oProfile As ProfileData In Profiles
|
For Each oProfile As ProfileData In Profiles
|
||||||
_Logger.Debug("Checking WindowDefinition for profile: {0}...", oProfile.Name)
|
_Logger.Debug("Checking WindowDefinition for profile: {0}...", oProfile.Name)
|
||||||
If oProfile.IsMatched = False Then Continue For
|
|
||||||
Dim oWindows As New List(Of WindowData)
|
Dim oWindows As New List(Of WindowData)
|
||||||
|
|
||||||
|
' If Profile has no windows at all, it automatically matches
|
||||||
|
If oProfile.Windows.Count = 0 Then
|
||||||
|
oProfile.IsMatched = True
|
||||||
|
oProfiles.Add(oProfile)
|
||||||
|
|
||||||
|
Continue For
|
||||||
|
End If
|
||||||
|
|
||||||
For Each oWindowDef As WindowData In oProfile.Windows
|
For Each oWindowDef As WindowData In oProfile.Windows
|
||||||
If oWindowDef.WindowProcessID <> oProfile.MatchedProcessID Then Continue For
|
If oWindowDef.WindowProcessID <> oProfile.MatchedProcessID Then Continue For
|
||||||
Try
|
Try
|
||||||
@@ -186,10 +192,13 @@ Public Class ProfileFilter
|
|||||||
End Try
|
End Try
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
' If Profile has windows that matched, the profile matches
|
||||||
If oWindows.Count > 0 Then
|
If oWindows.Count > 0 Then
|
||||||
oProfile.Windows = oWindows
|
oProfile.Windows = oWindows
|
||||||
oProfile.IsMatched = True
|
oProfile.IsMatched = True
|
||||||
oProfiles.Add(oProfile)
|
oProfiles.Add(oProfile)
|
||||||
|
|
||||||
|
_Logger.Info("Profile {0} matched!", oProfile.Name)
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
@@ -201,8 +210,7 @@ Public Class ProfileFilter
|
|||||||
Dim oWindow As New Window(_LogConfig)
|
Dim oWindow As New Window(_LogConfig)
|
||||||
|
|
||||||
For Each oProfile In Profiles
|
For Each oProfile In Profiles
|
||||||
If oProfile.IsMatched = False Then Continue For
|
' If Profile has no controls at all, it automatically matches
|
||||||
|
|
||||||
If oProfile.Controls.Count = 0 Then
|
If oProfile.Controls.Count = 0 Then
|
||||||
oFilteredProfiles.Add(oProfile)
|
oFilteredProfiles.Add(oProfile)
|
||||||
Continue For
|
Continue For
|
||||||
@@ -246,13 +254,15 @@ Public Class ProfileFilter
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
' If Profile has controls that matched, the profile matches
|
||||||
If oControls.Count > 0 Then
|
If oControls.Count > 0 Then
|
||||||
oProfile.Controls = oControls
|
oProfile.Controls = oControls
|
||||||
oFilteredProfiles.Add(oProfile)
|
oFilteredProfiles.Add(oProfile)
|
||||||
|
|
||||||
|
_Logger.Info("Profile {0} matched!", oProfile.Name)
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|
||||||
Return oFilteredProfiles
|
Return oFilteredProfiles
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
@@ -320,10 +330,14 @@ Public Class ProfileFilter
|
|||||||
End Try
|
End Try
|
||||||
Next
|
Next
|
||||||
|
|
||||||
If oResultData > 0 Or oResultDocs > 0 Then
|
oProfile.CountData = oResultData
|
||||||
oProfile.CountData = oResultData
|
oProfile.CountDocs = oResultDocs
|
||||||
oProfile.CountDocs = oResultDocs
|
Next
|
||||||
|
|
||||||
|
For Each oProfile In Profiles
|
||||||
|
If oProfile.CountData > 0 Or oProfile.CountDocs > 0 Then
|
||||||
oProfiles.Add(oProfile)
|
oProfiles.Add(oProfile)
|
||||||
|
_Logger.Info("Profile {0} matched!", oProfile.Name)
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
@@ -368,6 +382,8 @@ Public Class ProfileFilter
|
|||||||
If oWindows.Count > 0 Then
|
If oWindows.Count > 0 Then
|
||||||
oProfile.Windows = oWindows
|
oProfile.Windows = oWindows
|
||||||
oProfiles.Add(oProfile)
|
oProfiles.Add(oProfile)
|
||||||
|
|
||||||
|
_Logger.Info("Profile {0} matched!", oProfile.Name)
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ Public Class ProfileMatch
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function NewProfileNode(Profile As ProfileData) As TreeNode
|
Public Function NewProfileNode(Profile As ProfileData) As TreeNode
|
||||||
|
_Logger.Debug("New Profile Node for Profile {0}", Profile.Name)
|
||||||
|
|
||||||
Dim oNode As New TreeNode() With {
|
Dim oNode As New TreeNode() With {
|
||||||
.Text = $"Profile: {Profile.Name}",
|
.Text = $"Profile: {Profile.Name}",
|
||||||
.ImageIndex = ProfileFilter.ImageIndex.Profile,
|
.ImageIndex = ProfileFilter.ImageIndex.Profile,
|
||||||
@@ -35,8 +37,9 @@ Public Class ProfileMatch
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function NewClipboardRegexNode(Profile As ProfileData, IsMatch As Boolean) As TreeNode
|
Public Function NewClipboardRegexNode(Profile As ProfileData, IsMatch As Boolean) As TreeNode
|
||||||
Dim oText = $"{GetMatchText(IsMatch)} on Global Clipboard Regex {Profile.Regex}"
|
_Logger.Debug("New Clipboard Regex Node for Profile {0}", Profile.Name)
|
||||||
|
|
||||||
|
Dim oText = $"{GetMatchText(IsMatch)} on Global Clipboard Regex {Profile.Regex}"
|
||||||
Dim oNode As New TreeNode() With {
|
Dim oNode As New TreeNode() With {
|
||||||
.Text = oText,
|
.Text = oText,
|
||||||
.ImageIndex = ProfileFilter.ImageIndex.Clipboard,
|
.ImageIndex = ProfileFilter.ImageIndex.Clipboard,
|
||||||
@@ -47,9 +50,10 @@ Public Class ProfileMatch
|
|||||||
Return oNode
|
Return oNode
|
||||||
End Function
|
End Function
|
||||||
Public Function NewProcessNode(Profile As ProfileData, Process As ProcessData, IsMatch As Boolean) As TreeNode
|
Public Function NewProcessNode(Profile As ProfileData, Process As ProcessData, IsMatch As Boolean) As TreeNode
|
||||||
|
_Logger.Debug("New Process Node for Profile {0} and ProcessName {1}", Profile.Name, Process.ProcessName)
|
||||||
|
|
||||||
Dim oMatchText = IIf(IsMatch, "MATCH", "NO MATCH")
|
Dim oMatchText = IIf(IsMatch, "MATCH", "NO MATCH")
|
||||||
Dim oText = $"{GetMatchText(IsMatch)} on ProcessName {Process.ProcessName}"
|
Dim oText = $"{GetMatchText(IsMatch)} on ProcessName {Process.ProcessName}"
|
||||||
|
|
||||||
Dim oNode As New TreeNode() With {
|
Dim oNode As New TreeNode() With {
|
||||||
.Text = oText,
|
.Text = oText,
|
||||||
.ImageIndex = ProfileFilter.ImageIndex.Process,
|
.ImageIndex = ProfileFilter.ImageIndex.Process,
|
||||||
@@ -61,9 +65,10 @@ Public Class ProfileMatch
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function NewWindowNode(Profile As ProfileData, Window As WindowData, IsMatch As Boolean) As TreeNode
|
Public Function NewWindowNode(Profile As ProfileData, Window As WindowData, IsMatch As Boolean) As TreeNode
|
||||||
|
_Logger.Debug("New Window Node for Profile {0} and WindowTitle {1}", Profile.Name, Window.Title)
|
||||||
|
|
||||||
Dim oMatchText = IIf(IsMatch, "MATCH", "NO MATCH")
|
Dim oMatchText = IIf(IsMatch, "MATCH", "NO MATCH")
|
||||||
Dim oText = $"{GetMatchText(IsMatch)} on WindowTitle {Window.Title}"
|
Dim oText = $"{GetMatchText(IsMatch)} on WindowTitle {Window.Title}"
|
||||||
|
|
||||||
Dim oNode As New TreeNode() With {
|
Dim oNode As New TreeNode() With {
|
||||||
.Text = oText,
|
.Text = oText,
|
||||||
.ImageIndex = ProfileFilter.ImageIndex.Window,
|
.ImageIndex = ProfileFilter.ImageIndex.Window,
|
||||||
@@ -75,6 +80,8 @@ Public Class ProfileMatch
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function NewControlNode(Profile As ProfileData, Control As ControlData, IsMatch As Boolean) As TreeNode
|
Public Function NewControlNode(Profile As ProfileData, Control As ControlData, IsMatch As Boolean) As TreeNode
|
||||||
|
_Logger.Debug("New Control Node for Profile {0} and Control {1}", Profile.Name, Control.Description)
|
||||||
|
|
||||||
Dim oMatchText = IIf(IsMatch, "MATCH", "NO MATCH")
|
Dim oMatchText = IIf(IsMatch, "MATCH", "NO MATCH")
|
||||||
Dim oText = $"{GetMatchText(IsMatch)} on Control {Control.Description}: {IsMatch.ToString}"
|
Dim oText = $"{GetMatchText(IsMatch)} on Control {Control.Description}: {IsMatch.ToString}"
|
||||||
|
|
||||||
|
|||||||
103
GUIs.Common/Base/BaseErrorHandler.vb
Normal file
103
GUIs.Common/Base/BaseErrorHandler.vb
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
Imports System.Reflection
|
||||||
|
Imports System.Windows.Forms
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
|
Namespace Base
|
||||||
|
Public Class BaseErrorHandler
|
||||||
|
Private _LogConfig As LogConfig
|
||||||
|
Private _Logger As Logger
|
||||||
|
Private _Form As Form
|
||||||
|
|
||||||
|
Private Const UNKNOWN_METHOD = "Unknown Method"
|
||||||
|
Private Const UNKNOWN_FORM = "Unknown Form"
|
||||||
|
|
||||||
|
Public Sub New(LogConfig As LogConfig, Logger As Logger, Form As Form)
|
||||||
|
_LogConfig = LogConfig
|
||||||
|
_Logger = Logger
|
||||||
|
_Form = Form
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub ShowErrorMessage(Exception As Exception)
|
||||||
|
_Logger.Error(Exception)
|
||||||
|
MessageBox.Show(GetMessage(Exception), _Form.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub ShowInfoMessage(Text As String)
|
||||||
|
_Logger.Info(Text)
|
||||||
|
MessageBox.Show(Text, _Form.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function GetMessage(Exception As Exception) As String
|
||||||
|
Dim oTargetSite = Exception.TargetSite
|
||||||
|
Dim oMethodName = GetMethodName(Exception)
|
||||||
|
Dim oFormName = GetFormName(Exception)
|
||||||
|
Dim oMessage As String = String.Empty
|
||||||
|
|
||||||
|
If TypeOf Exception Is SqlClient.SqlException Then
|
||||||
|
Dim oNumber As Integer = DirectCast(Exception, SqlClient.SqlException).Number
|
||||||
|
Select Case oNumber
|
||||||
|
Case 2627
|
||||||
|
oMessage = "Es wurde ein Doppelter Wert in eine Spalte eingetragen, die einzigartig sein muss."
|
||||||
|
End Select
|
||||||
|
ElseIf TypeOf Exception Is NoNullAllowedException Then
|
||||||
|
oMessage = "Einige benötigte Felder wurde nicht ausgefüllt."
|
||||||
|
Else
|
||||||
|
oMessage = $"Es ist ein unerwarteter Fehler in {oFormName}/{oMethodName} aufgetreten. Mehr Informationen finden Sie im Log."
|
||||||
|
End If
|
||||||
|
|
||||||
|
If _LogConfig.Debug Then
|
||||||
|
oMessage &= vbNewLine & vbNewLine & "== Debug Informationen =="
|
||||||
|
oMessage &= vbNewLine & vbNewLine & "Die ursprüngliche Fehlermeldung lautet:"
|
||||||
|
oMessage &= vbNewLine & Exception.Message
|
||||||
|
oMessage &= vbNewLine & vbNewLine & "Stacktrace:"
|
||||||
|
oMessage &= vbNewLine & Exception.StackTrace
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return oMessage
|
||||||
|
End Function
|
||||||
|
|
||||||
|
'Private Function GetMessage(Exception As Exception) As String
|
||||||
|
' Dim oTargetSite = Exception.TargetSite
|
||||||
|
' Dim oMethodName = GetMethodName(Exception)
|
||||||
|
' Dim oFormName = GetFormName(Exception)
|
||||||
|
' Dim oMessage As String = String.Empty
|
||||||
|
|
||||||
|
' oMessage &= $"Form: {oFormName}{vbNewLine}"
|
||||||
|
' oMessage &= $"Method: {oMethodName}{vbNewLine}"
|
||||||
|
|
||||||
|
' If Not String.IsNullOrEmpty(Exception.StackTrace) Then
|
||||||
|
' oMessage &= $"Message: {Exception.Message}{vbNewLine}{vbNewLine}"
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' If Not String.IsNullOrEmpty(Exception.StackTrace) Then
|
||||||
|
' oMessage &= $"Stacktrace: {Exception.StackTrace}{vbNewLine}"
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' oMessage &= $"{vbNewLine}"
|
||||||
|
' oMessage &= $"Please report this error to error@digitaldata.works"
|
||||||
|
|
||||||
|
' Return oMessage
|
||||||
|
'End Function
|
||||||
|
|
||||||
|
Private Function GetMethodName(Exception As Exception) As String
|
||||||
|
Dim oMethodName = Exception.TargetSite?.Name
|
||||||
|
|
||||||
|
If oMethodName Is Nothing Then
|
||||||
|
Return UNKNOWN_METHOD
|
||||||
|
Else
|
||||||
|
Return oMethodName
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Function GetFormName(Exception As Exception) As String
|
||||||
|
Dim oFormName = Exception.TargetSite?.ReflectedType?.Name
|
||||||
|
|
||||||
|
If oFormName Is Nothing Then
|
||||||
|
Return UNKNOWN_FORM
|
||||||
|
Else
|
||||||
|
Return oFormName
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
|
|
||||||
|
End Namespace
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
Imports System.Reflection
|
|
||||||
Imports System.Windows.Forms
|
|
||||||
Imports DigitalData.Modules.Logging
|
|
||||||
|
|
||||||
Namespace Base
|
|
||||||
Public Class BaseErrorHandler
|
|
||||||
Private _Logger As Logger
|
|
||||||
Private _Form As Form
|
|
||||||
|
|
||||||
Private Const UNKNOWN_METHOD = "Unknown Method"
|
|
||||||
Private Const UNKNOWN_FORM = "Unknown Form"
|
|
||||||
|
|
||||||
Public Sub New(Logger As Logger, Form As Form)
|
|
||||||
_Logger = Logger
|
|
||||||
_Form = Form
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub ShowErrorMessage(Exception As Exception)
|
|
||||||
_Logger.Error(Exception)
|
|
||||||
MessageBox.Show(GetMessage(Exception), _Form.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub ShowInfoMessage(Text As String)
|
|
||||||
_Logger.Info(Text)
|
|
||||||
MessageBox.Show(Text, _Form.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Function GetMessage(Exception As Exception) As String
|
|
||||||
Dim oTargetSite = Exception.TargetSite
|
|
||||||
Dim oMethodName = GetMethodName(Exception)
|
|
||||||
Dim oFormName = GetFormName(Exception)
|
|
||||||
Dim oMessage As String = String.Empty
|
|
||||||
|
|
||||||
oMessage &= $"Form: {oFormName}{vbNewLine}"
|
|
||||||
oMessage &= $"Method: {oMethodName}{vbNewLine}"
|
|
||||||
|
|
||||||
If Not String.IsNullOrEmpty(Exception.StackTrace) Then
|
|
||||||
oMessage &= $"Message: {Exception.Message}{vbNewLine}{vbNewLine}"
|
|
||||||
End If
|
|
||||||
|
|
||||||
If Not String.IsNullOrEmpty(Exception.StackTrace) Then
|
|
||||||
oMessage &= $"Stacktrace: {Exception.StackTrace}{vbNewLine}"
|
|
||||||
End If
|
|
||||||
|
|
||||||
oMessage &= $"{vbNewLine}"
|
|
||||||
oMessage &= $"Please report this error to error@digitaldata.works"
|
|
||||||
|
|
||||||
Return oMessage
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Private Function GetMethodName(Exception As Exception) As String
|
|
||||||
Dim oMethodName = Exception.TargetSite?.ReflectedType?.Name
|
|
||||||
|
|
||||||
If oMethodName Is Nothing Then
|
|
||||||
Return UNKNOWN_METHOD
|
|
||||||
Else
|
|
||||||
Return oMethodName
|
|
||||||
End If
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Private Function GetFormName(Exception As Exception) As String
|
|
||||||
Dim oFormName = Exception.TargetSite?.ReflectedType?.ReflectedType?.Name
|
|
||||||
|
|
||||||
If oFormName Is Nothing Then
|
|
||||||
Return UNKNOWN_FORM
|
|
||||||
Else
|
|
||||||
Return oFormName
|
|
||||||
End If
|
|
||||||
End Function
|
|
||||||
End Class
|
|
||||||
|
|
||||||
End Namespace
|
|
||||||
@@ -12,8 +12,6 @@ Namespace Base
|
|||||||
'''
|
'''
|
||||||
''' ...
|
''' ...
|
||||||
''' End Class
|
''' End Class
|
||||||
'''
|
|
||||||
''' Only BaseRibbonForms can have panels attached to it!
|
|
||||||
''' </summary>
|
''' </summary>
|
||||||
Public Class BaseRibbonForm
|
Public Class BaseRibbonForm
|
||||||
Inherits RibbonForm
|
Inherits RibbonForm
|
||||||
@@ -27,37 +25,9 @@ Namespace Base
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
''' <summary>
|
Public Sub New()
|
||||||
''' Sets or gets the ribbon Page that will be shown when the window is visible
|
|
||||||
''' </summary>
|
|
||||||
''' <returns></returns>
|
|
||||||
Public Property DefaultRibbonPage As RibbonPage
|
|
||||||
|
|
||||||
Protected Overrides Sub OnLoad(e As EventArgs)
|
|
||||||
MyBase.OnLoad(e)
|
|
||||||
|
|
||||||
If DefaultRibbonPage IsNot Nothing Then
|
|
||||||
Ribbon.SelectPage(DefaultRibbonPage)
|
|
||||||
End If
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Overrides Sub OnVisibleChanged(e As EventArgs)
|
|
||||||
MyBase.OnVisibleChanged(e)
|
|
||||||
|
|
||||||
If Visible And DefaultRibbonPage IsNot Nothing Then
|
|
||||||
Ribbon.SelectPage(DefaultRibbonPage)
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Protected Overrides Sub OnActivated(e As EventArgs)
|
|
||||||
MyBase.OnVisibleChanged(e)
|
|
||||||
|
|
||||||
If Visible And DefaultRibbonPage IsNot Nothing Then
|
|
||||||
Ribbon.SelectPage(DefaultRibbonPage)
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
|
|
||||||
Public Sub New(LogConfig As LogConfig)
|
Public Sub New(LogConfig As LogConfig)
|
||||||
' Get the full name of the inheriting form
|
' Get the full name of the inheriting form
|
||||||
' so the log messages have the right classname
|
' so the log messages have the right classname
|
||||||
@@ -65,19 +35,21 @@ Namespace Base
|
|||||||
|
|
||||||
' My.LogConfig is undefined in the designer
|
' My.LogConfig is undefined in the designer
|
||||||
_Logger = LogConfig?.GetLogger(oClassName)
|
_Logger = LogConfig?.GetLogger(oClassName)
|
||||||
_ErrorHandler = New BaseErrorHandler(_Logger, Me)
|
_ErrorHandler = New BaseErrorHandler(LogConfig, _Logger, Me)
|
||||||
|
|
||||||
' When you add something, be careful if it
|
' When you add something, be careful if it
|
||||||
' depends on a global var like My.LogConfig
|
' depends on a global var like My.LogConfig
|
||||||
' you might need to check for its existence with ?
|
' you might need to check for its existence with ?
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
''' ============== PUBLIC METHODS ==============
|
||||||
|
|
||||||
Public Sub ShowErrorMessage(Exception As Exception)
|
Public Sub ShowErrorMessage(Exception As Exception)
|
||||||
_ErrorHandler.ShowErrorMessage(Exception)
|
_ErrorHandler.ShowErrorMessage(Exception)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub ShowErrorMessage(ErrorMessage As String)
|
Public Sub ShowErrorMessage(ErrorMessage As String)
|
||||||
_ErrorHandler.ShowErrorMessage(New Exception(ErrorMessage))
|
_ErrorHandler.ShowErrorMessage(New ApplicationException(ErrorMessage))
|
||||||
End Sub
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
End Namespace
|
End Namespace
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
<Import Include="System.Threading.Tasks" />
|
<Import Include="System.Threading.Tasks" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Base\BaseMessageBox.vb" />
|
<Compile Include="Base\BaseErrorHandler.vb" />
|
||||||
<Compile Include="Base\BaseRibbonForm.vb">
|
<Compile Include="Base\BaseRibbonForm.vb">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -214,5 +214,14 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Resources\png.png" />
|
<None Include="Resources\png.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\Article_32x32.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\Open_32x32.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\Copy_32x32.png" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -223,22 +223,25 @@ Partial Class frmDocumentResultList
|
|||||||
'
|
'
|
||||||
Me.ContextMenuGrid.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.DateiÖffnenToolStripMenuItem, Me.OrdnerÖffnenToolStripMenuItem, Me.PfadInZwischenablageKopierenToolStripMenuItem})
|
Me.ContextMenuGrid.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.DateiÖffnenToolStripMenuItem, Me.OrdnerÖffnenToolStripMenuItem, Me.PfadInZwischenablageKopierenToolStripMenuItem})
|
||||||
Me.ContextMenuGrid.Name = "ContextMenuGrid"
|
Me.ContextMenuGrid.Name = "ContextMenuGrid"
|
||||||
Me.ContextMenuGrid.Size = New System.Drawing.Size(200, 70)
|
Me.ContextMenuGrid.Size = New System.Drawing.Size(200, 92)
|
||||||
'
|
'
|
||||||
'DateiÖffnenToolStripMenuItem
|
'DateiÖffnenToolStripMenuItem
|
||||||
'
|
'
|
||||||
|
Me.DateiÖffnenToolStripMenuItem.Image = Global.DigitalData.GUIs.Common.My.Resources.Resources.Article_32x32
|
||||||
Me.DateiÖffnenToolStripMenuItem.Name = "DateiÖffnenToolStripMenuItem"
|
Me.DateiÖffnenToolStripMenuItem.Name = "DateiÖffnenToolStripMenuItem"
|
||||||
Me.DateiÖffnenToolStripMenuItem.Size = New System.Drawing.Size(199, 22)
|
Me.DateiÖffnenToolStripMenuItem.Size = New System.Drawing.Size(199, 22)
|
||||||
Me.DateiÖffnenToolStripMenuItem.Text = "Datei öffnen"
|
Me.DateiÖffnenToolStripMenuItem.Text = "Datei öffnen"
|
||||||
'
|
'
|
||||||
'OrdnerÖffnenToolStripMenuItem
|
'OrdnerÖffnenToolStripMenuItem
|
||||||
'
|
'
|
||||||
|
Me.OrdnerÖffnenToolStripMenuItem.Image = Global.DigitalData.GUIs.Common.My.Resources.Resources.Open_32x32
|
||||||
Me.OrdnerÖffnenToolStripMenuItem.Name = "OrdnerÖffnenToolStripMenuItem"
|
Me.OrdnerÖffnenToolStripMenuItem.Name = "OrdnerÖffnenToolStripMenuItem"
|
||||||
Me.OrdnerÖffnenToolStripMenuItem.Size = New System.Drawing.Size(199, 22)
|
Me.OrdnerÖffnenToolStripMenuItem.Size = New System.Drawing.Size(199, 22)
|
||||||
Me.OrdnerÖffnenToolStripMenuItem.Text = "Ordner öffnen"
|
Me.OrdnerÖffnenToolStripMenuItem.Text = "Ordner öffnen"
|
||||||
'
|
'
|
||||||
'PfadInZwischenablageKopierenToolStripMenuItem
|
'PfadInZwischenablageKopierenToolStripMenuItem
|
||||||
'
|
'
|
||||||
|
Me.PfadInZwischenablageKopierenToolStripMenuItem.Image = Global.DigitalData.GUIs.Common.My.Resources.Resources.Copy_32x32
|
||||||
Me.PfadInZwischenablageKopierenToolStripMenuItem.Name = "PfadInZwischenablageKopierenToolStripMenuItem"
|
Me.PfadInZwischenablageKopierenToolStripMenuItem.Name = "PfadInZwischenablageKopierenToolStripMenuItem"
|
||||||
Me.PfadInZwischenablageKopierenToolStripMenuItem.Size = New System.Drawing.Size(199, 22)
|
Me.PfadInZwischenablageKopierenToolStripMenuItem.Size = New System.Drawing.Size(199, 22)
|
||||||
Me.PfadInZwischenablageKopierenToolStripMenuItem.Text = "Pfad in Zwischenablage"
|
Me.PfadInZwischenablageKopierenToolStripMenuItem.Text = "Pfad in Zwischenablage"
|
||||||
|
|||||||
30
GUIs.Common/My Project/Resources.Designer.vb
generated
30
GUIs.Common/My Project/Resources.Designer.vb
generated
@@ -80,6 +80,26 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property Article_32x32() As System.Drawing.Bitmap
|
||||||
|
Get
|
||||||
|
Dim obj As Object = ResourceManager.GetObject("Article_32x32", resourceCulture)
|
||||||
|
Return CType(obj,System.Drawing.Bitmap)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property Copy_32x32() As System.Drawing.Bitmap
|
||||||
|
Get
|
||||||
|
Dim obj As Object = ResourceManager.GetObject("Copy_32x32", resourceCulture)
|
||||||
|
Return CType(obj,System.Drawing.Bitmap)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||||
'''</summary>
|
'''</summary>
|
||||||
@@ -120,6 +140,16 @@ Namespace My.Resources
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
'''<summary>
|
||||||
|
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||||
|
'''</summary>
|
||||||
|
Friend ReadOnly Property Open_32x32() As System.Drawing.Bitmap
|
||||||
|
Get
|
||||||
|
Dim obj As Object = ResourceManager.GetObject("Open_32x32", resourceCulture)
|
||||||
|
Return CType(obj,System.Drawing.Bitmap)
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
'''<summary>
|
'''<summary>
|
||||||
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
''' Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
|
||||||
'''</summary>
|
'''</summary>
|
||||||
|
|||||||
@@ -118,23 +118,8 @@
|
|||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
<data name="doc" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="Open_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\doc.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\Open_32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
|
||||||
<data name="dwg" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\dwg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="dxf" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\dxf.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="jpg" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\jpg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="pdf" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\pdf.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="png" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
</data>
|
||||||
<data name="ppt" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="ppt" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\ppt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\ppt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
@@ -142,16 +127,40 @@
|
|||||||
<data name="tiff" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="tiff" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\tiff.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\tiff.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="txt" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="pdf" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\txt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\pdf.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="xls" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="jpg" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\xls.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\jpg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
|
||||||
<data name="_blank" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\_blank.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
</data>
|
||||||
<data name="_page" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="_page" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\_page.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\_page.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="dwg" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\dwg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="doc" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\doc.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="txt" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\txt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="png" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="_blank" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\_blank.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="xls" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\xls.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="dxf" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\dxf.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Article_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Article_32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="Copy_32x32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Copy_32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
BIN
GUIs.Common/Resources/Article_32x32.png
Normal file
BIN
GUIs.Common/Resources/Article_32x32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 281 B |
BIN
GUIs.Common/Resources/Copy_32x32.png
Normal file
BIN
GUIs.Common/Resources/Copy_32x32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 310 B |
BIN
GUIs.Common/Resources/Open_32x32.png
Normal file
BIN
GUIs.Common/Resources/Open_32x32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 265 B |
@@ -57,15 +57,11 @@ Public Class Window
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
Public Function GetWindowInfo(ByVal hWnd As IntPtr) As WindowInfo
|
Public Function GetWindowInfo(ByVal hWnd As IntPtr) As WindowInfo
|
||||||
Try
|
Try
|
||||||
_Logger.Debug("Getting Window Info")
|
|
||||||
|
|
||||||
Dim oPID As Integer = 0
|
Dim oPID As Integer = 0
|
||||||
Dim oTitleLength As Int32 = NativeMethods.GetWindowTextLength(hWnd)
|
Dim oTitleLength As Int32 = NativeMethods.GetWindowTextLength(hWnd)
|
||||||
Dim oWindowTitle As String = StrDup(oTitleLength + 1, "*")
|
Dim oWindowTitle As String = StrDup(oTitleLength + 1, "*")
|
||||||
Dim oClassBuilder As New StringBuilder(64)
|
Dim oClassBuilder As New StringBuilder(64)
|
||||||
|
|
||||||
_Logger.Debug("Getting Window Text and PID")
|
|
||||||
|
|
||||||
NativeMethods.GetWindowText(hWnd, oWindowTitle, oTitleLength + 1)
|
NativeMethods.GetWindowText(hWnd, oWindowTitle, oTitleLength + 1)
|
||||||
NativeMethods.GetWindowThreadProcessId(hWnd, oPID)
|
NativeMethods.GetWindowThreadProcessId(hWnd, oPID)
|
||||||
|
|
||||||
@@ -79,8 +75,6 @@ Public Class Window
|
|||||||
Return Nothing
|
Return Nothing
|
||||||
End If
|
End If
|
||||||
|
|
||||||
_Logger.Debug("Getting Class Name")
|
|
||||||
|
|
||||||
NativeMethods.GetClassName(hWnd, oClassBuilder, 64)
|
NativeMethods.GetClassName(hWnd, oClassBuilder, 64)
|
||||||
|
|
||||||
Return New WindowInfo With {
|
Return New WindowInfo With {
|
||||||
|
|||||||
Reference in New Issue
Block a user