WIP: Config UI

This commit is contained in:
Jonathan Jenne
2019-07-22 16:02:18 +02:00
parent da579381ce
commit dfadc2b778
11 changed files with 1068 additions and 908 deletions

View File

@@ -278,39 +278,67 @@ Public Class frmStart
Dim oProfiles = CURRENT_MATCHING_PROFILES
For Each oProfile In oProfiles
Dim oSQL = oProfile.SQLCountDocs
Dim oDocumentSQL = oProfile.SQLCountDocs
Dim oDataSQL = oProfile.SQLCountData
Dim oResultDocs As Integer = 0
Dim oResultData As Integer = 0
If oSQL = String.Empty Then
If oDataSQL = String.Empty Then
oProfile.SQLCountData = ClassConstants.NO_COUNT_SQL
End If
If oDocumentSQL = String.Empty Then
oProfile.SQLCountDocs = ClassConstants.NO_COUNT_SQL
End If
Try
oSQL = clsPatterns.ReplaceAllValues(oSQL, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfile.Guid)
oResultDocs = ClassDatabase.Execute_Scalar(oSQL, MyConnectionString)
oDataSQL = clsPatterns.ReplaceAllValues(oDataSQL, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfile.Guid)
oResultData = ClassDatabase.Execute_Scalar(oDataSQL, MyConnectionString)
Catch ex As Exception
Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oDataSQL)
oResultData = ClassConstants.INVALID_COUNT_SQL
End Try
Try
oDocumentSQL = clsPatterns.ReplaceAllValues(oDocumentSQL, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfile.Guid)
oResultDocs = ClassDatabase.Execute_Scalar(oDocumentSQL, MyConnectionString)
Catch ex As Exception
Logger.Warn("Invalid SQL Query for Counting Documents in Profile {0}: {1}", oProfile.Guid, oDocumentSQL)
oResultDocs = ClassConstants.INVALID_COUNT_SQL
End Try
oProfile.CountData = oResultData
oProfile.CountDocs = oResultDocs
Next
If oProfiles.Count = 1 Then
If oProfiles.First().CountDocs = ClassConstants.INVALID_COUNT_SQL Then
NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", "Found match but check is wrong - Check Your MatchCountConfig in Profiles!", ToolTipIcon.Info)
Exit Sub
End If
'If oProfiles.Count = 1 Then
' If oProfiles.First().CountDocs = ClassConstants.INVALID_COUNT_SQL Then
' NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", "Found match but check is wrong - Check Your Data SQL in Profiles!", ToolTipIcon.Info)
' Exit Sub
' End If
If oProfiles.First().CountDocs = ClassConstants.NO_COUNT_SQL Then
NotifyIconMain.ShowBalloonTip(10000, "Clipboard Watcher", "Found match but MatchCountConfig is not configured!", ToolTipIcon.Info)
Exit Sub
End If
' If oProfiles.First().CountDocs = ClassConstants.NO_COUNT_SQL Then
' NotifyIconMain.ShowBalloonTip(10000, "Clipboard Watcher", "Found match but Data SQL is not configured!", ToolTipIcon.Info)
' Exit Sub
' End If
CurrDocSearch2Load = oProfiles.First().Guid
frmResultDoc.Show()
Else
frmProfileMatch.ShowDialog()
End If
' If oProfiles.First().CountData = ClassConstants.INVALID_COUNT_SQL Then
' NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", "Found match but check is wrong - Check Your Document SQL in Profiles!", ToolTipIcon.Info)
' Exit Sub
' End If
' If oProfiles.First().CountData = ClassConstants.NO_COUNT_SQL Then
' NotifyIconMain.ShowBalloonTip(10000, "Clipboard Watcher", "Found match but Document SQL is not configured!", ToolTipIcon.Info)
' Exit Sub
' End If
' CurrDocSearch2Load = oProfiles.First().Guid
' frmResultDoc.Show()
'Else
' frmProfileMatch.ShowDialog()
'End If
frmProfileMatch.ShowDialog()
End Sub
Sub Change_Monitoring_State()
If MONITORING_ACTIVE = True Then