File tree Expand file tree Collapse file tree 3 files changed +26
-12
lines changed Expand file tree Collapse file tree 3 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,17 @@ Imports WinNUT_Client_Common
11
11
12
12
Public Class List_Var_Gui
13
13
Private List_Var_Datas As List( Of UPS_List_Datas)
14
+ Private UPSDevice As UPS_Device
14
15
Private UPS_Name = WinNUT.UPS_Device.Nut_Config.UPSName
15
16
17
+ Public Sub New (upsDev As UPS_Device)
18
+ ' This call is required by the designer.
19
+ InitializeComponent()
20
+
21
+ ' Add any initialization after the InitializeComponent() call.
22
+ UPSDevice = upsDev
23
+ End Sub
24
+
16
25
Private Sub List_Var_Gui_Load(sender As Object , e As EventArgs) Handles MyBase .Load
17
26
LogFile.LogTracing( "Load List Var Gui" , LogLvl.LOG_DEBUG, Me )
18
27
Icon = WinNUT.Icon
@@ -22,10 +31,13 @@ Public Class List_Var_Gui
22
31
End Sub
23
32
24
33
Private Sub PopulateTreeView()
25
- Dim action As Action
26
34
LogFile.LogTracing( "Populate TreeView" , LogLvl.LOG_DEBUG, Me )
35
+ Dim action As Action
36
+
27
37
Try
38
+ UPSDevice.IsUpdatingData = False
28
39
List_Var_Datas = WinNUT.UPS_Device.GetUPS_ListVar()
40
+ UPSDevice.IsUpdatingData = True
29
41
Catch ex As Exception
30
42
' TODO: Internationalize?
31
43
MessageBox.Show( "Error encountered trying to get variables from the UPS: " & vbNewLine & ex.Message, "Error Encountered" )
Original file line number Diff line number Diff line change @@ -1006,9 +1006,8 @@ Public Class WinNUT
1006
1006
1007
1007
Private Sub Menu_UPS_Var_Click(sender As Object , e As EventArgs) Handles Menu_UPS_Var.Click
1008
1008
LogFile.LogTracing( "Open List Var Gui" , LogLvl.LOG_DEBUG, Me )
1009
- List_Var_Gui.Activate()
1010
- List_Var_Gui.Visible = True
1011
- HasFocus = False
1009
+ Dim lvgForm = New List_Var_Gui(UPS_Device)
1010
+ lvgForm.Show()
1012
1011
End Sub
1013
1012
1014
1013
Public Sub Update_InstantLog(sender As Object ) Handles LogFile.NewData
Original file line number Diff line number Diff line change @@ -40,6 +40,16 @@ Public Class UPS_Device
40
40
End Set
41
41
End Property
42
42
43
+ Public Property IsUpdatingData As Boolean
44
+ Get
45
+ Return Update_Data.Enabled
46
+ End Get
47
+ Set (value As Boolean )
48
+ LogFile.LogTracing( "UPS device updating status is now [" & value & "]" , LogLvl.LOG_NOTICE, Me )
49
+ Update_Data.Enabled = value
50
+ End Set
51
+ End Property
52
+
43
53
Private upsData As UPSData
44
54
Public Property UPS_Datas As UPSData
45
55
Get
@@ -303,15 +313,8 @@ Public Class UPS_Device
303
313
Try
304
314
Dim UPS_rt_Status As String
305
315
Dim InputA As Double
306
- ' LogFile.LogTracing("Enter Retrieve_UPS_Data", LogLvl.LOG_DEBUG, Me)
307
- If IsConnected Then
308
- 'With UPS_Datas
309
- ' Select Case "Unknown"
310
- ' Case .Mfr, .Model, .Serial, .Firmware
311
- ' UPS_Datas = GetUPSProductInfo()
312
- ' End Select
313
- 'End With
314
316
317
+ If IsConnected Then
315
318
With UPS_Datas.UPS_Value
316
319
.Batt_Charge = Double .Parse(GetUPSVar( "battery.charge" , 255 ), ciClone)
317
320
.Batt_Voltage = Double .Parse(GetUPSVar( "battery.voltage" , 12 ), ciClone)
You can’t perform that action at this time.
0 commit comments