Tweaks for issue #125

This commit is contained in:
Michael J. Seiferling
2018-03-13 11:58:44 -06:00
parent a2c96ee5e4
commit 251ea3b060
+43 -35
View File
@@ -1267,11 +1267,51 @@ Public Class frmMain
End If End If
End Sub End Sub
Public Sub UpdateLog(sLogUpdate As String, Optional bTrayUpdate As Boolean = True, Optional objIcon As System.Windows.Forms.ToolTipIcon = ToolTipIcon.Info, Optional bTimeStamp As Boolean = True) Handles oBackup.UpdateLog, oRestore.UpdateLog Private Function NotifySendUnix(ByVal sLogUpdate As String, ByVal objIcon As System.Windows.Forms.ToolTipIcon) As Boolean
Dim prsNotify As Process Dim prsNotify As Process
Dim bNotifyFailed As Boolean
Dim sUrgency As String Dim sUrgency As String
Dim sNotifyArgs As String Dim sNotifyArgs As String
Dim bNotifyFailed As Boolean
'Build args for notify-send
Select Case objIcon
Case ToolTipIcon.Error
sUrgency = "critical"
Case ToolTipIcon.Warning
sUrgency = "normal"
Case ToolTipIcon.Info
sUrgency = "low"
Case Else
sUrgency = "low"
End Select
sNotifyArgs = "-i gbm " & "-u " & sUrgency & " """ & App_NameLong & """ ""<i>" & sLogUpdate.Replace("""", "\""") & "</i>"""
Try
'Execute notify-send
prsNotify = New Process
prsNotify.StartInfo.FileName = "/usr/bin/notify-send"
prsNotify.StartInfo.Arguments = sNotifyArgs
prsNotify.StartInfo.UseShellExecute = False
prsNotify.StartInfo.RedirectStandardOutput = True
prsNotify.StartInfo.CreateNoWindow = True
prsNotify.Start()
prsNotify.WaitForExit()
Select Case prsNotify.ExitCode
Case 0
bNotifyFailed = False
Case Else
bNotifyFailed = True
End Select
Catch
bNotifyFailed = True
End Try
Return bNotifyFailed
End Function
Public Sub UpdateLog(sLogUpdate As String, Optional bTrayUpdate As Boolean = True, Optional objIcon As System.Windows.Forms.ToolTipIcon = ToolTipIcon.Info, Optional bTimeStamp As Boolean = True) Handles oBackup.UpdateLog, oRestore.UpdateLog
Dim bNotifyFailed As Boolean
'Thread Safe (If one control requires an invoke assume they all do) 'Thread Safe (If one control requires an invoke assume they all do)
If txtLog.InvokeRequired = True Then If txtLog.InvokeRequired = True Then
@@ -1311,39 +1351,7 @@ Public Class frmMain
If bTrayUpdate Then If bTrayUpdate Then
If mgrCommon.IsUnix Then If mgrCommon.IsUnix Then
'Build args for notify-send bNotifyFailed = NotifySendUnix(sLogUpdate, objIcon)
Select Case objIcon
Case ToolTipIcon.Error
sUrgency = "critical"
Case ToolTipIcon.Warning
sUrgency = "normal"
Case ToolTipIcon.Info
sUrgency = "low"
Case Else
sUrgency = "low"
End Select
sNotifyArgs = "-i gbm " & "-u " & sUrgency & " """ & App_NameLong & """ """ & sLogUpdate.Replace("""", "\""") & """"
Try
'Execute notify-send
prsNotify = New Process
prsNotify.StartInfo.FileName = "/usr/bin/notify-send"
prsNotify.StartInfo.Arguments = sNotifyArgs
prsNotify.StartInfo.UseShellExecute = False
prsNotify.StartInfo.RedirectStandardOutput = True
prsNotify.StartInfo.CreateNoWindow = True
prsNotify.Start()
prsNotify.WaitForExit()
Select Case prsNotify.ExitCode
Case 0
bNotifyFailed = False
Case Else
bNotifyFailed = True
End Select
Catch
bNotifyFailed = True
End Try
End If End If
If Not mgrCommon.IsUnix Or bNotifyFailed Then If Not mgrCommon.IsUnix Or bNotifyFailed Then