@@ -402,10 +402,6 @@ Public Class WinNUT
402402 LogFile.LogTracing( "Connection to Nut Host Established" , LogLvl.LOG_NOTICE, Me ,
403403 String .Format(StrLog.Item(AppResxStr.STR_LOG_CONNECTED),
404404 upsConf.Host, upsConf.Port))
405-
406- If Not String .IsNullOrEmpty(upsConf.Login) Then
407- UPS_Device.Login()
408- End If
409405 End Sub
410406
411407 Private Sub ConnectionError(sender As UPS_Device, ex As Exception) Handles UPS_Device.ConnectionError
@@ -618,18 +614,6 @@ Public Class WinNUT
618614 HasFocus = False
619615 End Sub
620616
621- Public Shared Sub Event_ChangeStatus() Handles Me .On_Battery, Me .On_Line,
622- UPS_Device.Lost_Connect, UPS_Device.Connected, UPS_Device.Disconnected
623-
624- WinNUT.NotifyIcon.BalloonTipText = WinNUT.NotifyIcon.Text
625- If WinNUT.AllowToast And WinNUT.NotifyIcon.BalloonTipText <> "" Then
626- Dim Toastparts As String () = WinNUT.NotifyIcon.BalloonTipText.Split( New String () {Environment.NewLine}, StringSplitOptions.None)
627- WinNUT.ToastPopup.SendToast(Toastparts)
628- ElseIf WinNUT.NotifyIcon.Visible = True And WinNUT.NotifyIcon.BalloonTipText <> "" Then
629- WinNUT.NotifyIcon.ShowBalloonTip( 10000 )
630- End If
631- End Sub
632-
633617 Private Sub Update_UPS_Data() Handles UPS_Device.DataUpdated
634618 LogFile.LogTracing( "Updating UPS data for Form." , LogLvl.LOG_DEBUG, Me )
635619
@@ -875,6 +859,24 @@ Public Class WinNUT
875859 End If
876860 End Sub
877861
862+ ''' <summary>
863+ ''' Handle Toast (Windows 10+) and/or NotifyIcon pop-ups.
864+ ''' </summary>
865+ Private Sub ToastNotifyIcon() Handles Me .On_Battery, Me .On_Line, UPS_Device.Lost_Connect,
866+ UPS_Device.Connected, UPS_Device.Disconnected
867+
868+ LogFile.LogTracing( "ToastNotifyIcon running." , LogLvl.LOG_DEBUG, Me )
869+ NotifyIcon.BalloonTipText = NotifyIcon.Text
870+ If AllowToast And NotifyIcon.BalloonTipText <> "" Then
871+ Dim Toastparts As String () = NotifyIcon.BalloonTipText.Split( New String () {Environment.NewLine}, StringSplitOptions.None)
872+ LogFile.LogTracing( "Sending Toast popup with text: " & NotifyIcon.BalloonTipText, LogLvl.LOG_DEBUG, Me )
873+ ToastPopup.SendToast(Toastparts)
874+ ElseIf NotifyIcon.Visible = True And NotifyIcon.BalloonTipText <> "" Then
875+ LogFile.LogTracing( "Sending NotifyIcon ballowtip: " & NotifyIcon.BalloonTipText, LogLvl.LOG_DEBUG, Me )
876+ NotifyIcon.ShowBalloonTip( 10000 )
877+ End If
878+ End Sub
879+
878880 Private Function GetIcon(IconIdx As Integer ) As Icon
879881 Select Case IconIdx
880882 Case 1025
0 commit comments