@@ -402,10 +402,6 @@ Public Class WinNUT
402
402
LogFile.LogTracing( "Connection to Nut Host Established" , LogLvl.LOG_NOTICE, Me ,
403
403
String .Format(StrLog.Item(AppResxStr.STR_LOG_CONNECTED),
404
404
upsConf.Host, upsConf.Port))
405
-
406
- If Not String .IsNullOrEmpty(upsConf.Login) Then
407
- UPS_Device.Login()
408
- End If
409
405
End Sub
410
406
411
407
Private Sub ConnectionError(sender As UPS_Device, ex As Exception) Handles UPS_Device.ConnectionError
@@ -618,18 +614,6 @@ Public Class WinNUT
618
614
HasFocus = False
619
615
End Sub
620
616
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
-
633
617
Private Sub Update_UPS_Data() Handles UPS_Device.DataUpdated
634
618
LogFile.LogTracing( "Updating UPS data for Form." , LogLvl.LOG_DEBUG, Me )
635
619
@@ -875,6 +859,24 @@ Public Class WinNUT
875
859
End If
876
860
End Sub
877
861
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
+
878
880
Private Function GetIcon(IconIdx As Integer ) As Icon
879
881
Select Case IconIdx
880
882
Case 1025
0 commit comments