CW Start Variant

This commit is contained in:
2021-01-15 10:13:51 +01:00
parent 917bacfba4
commit 6092da362a
3 changed files with 36 additions and 12 deletions

View File

@@ -246,9 +246,25 @@ Public Class frmMain
End Try
If START_CW = True Then
bbtniCW.Caption = START_CW_CAPTION
bbtniCW.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
RibbonPageGroup4.Visible = True
Dim oPath
Select Case START_CW_LOC_VARIANT
Case "-1"
oPath = Directory.GetParent(Application.StartupPath).ToString
Case "0"
oPath = Application.StartupPath.ToString
End Select
oPath &= "\ClipboardWatcher\DD_Clipboard_Watcher.exe"
If File.Exists(oPath) Then
bbtniCW.Caption = START_CW_CAPTION
bbtniCW.Tag = oPath
bbtniCW.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
RibbonPageGroup4.Visible = True
Else
LOGGER.Warn($"Error in CW-Button init: Could not find CW.Exe {oPath}")
End If
End If
End If
@@ -2569,16 +2585,14 @@ Public Class frmMain
Private Sub bbtniCW_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniCW.ItemClick
Try
Dim oIndex = Application.StartupPath.ToString.LastIndexOf("\")
Dim oParentPath = Directory.GetParent(Application.StartupPath) '.ToString.Substring(0, oIndex)
Dim oPath = oParentPath.ToString & "\ClipboardWatcher\DD_Clipboard_Watcher.exe"
If File.Exists(oPath) Then
If File.Exists(bbtniCW.Tag) Then
Dim MyProcess As New Process()
MyProcess.StartInfo.FileName = oPath
MyProcess.StartInfo.FileName = bbtniCW.Tag
MyProcess.Start()
Else
LOGGER.Warn($"Clipboardwatcher-Exe not found [{oPath}]")
MsgBox("Global Hook/Clipboard Watcher could not be started!", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
LOGGER.Warn($"Clipboardwatcher-Exe not found [{bbtniCW.Tag}]")
MsgBox("Clipboard Watcher could not be started!", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
End If
Catch ex As Exception