diff --git a/WinNUT_V2/WinNUT-Client/List_Var_Gui.Designer.vb b/WinNUT_V2/WinNUT-Client/List_Var_Gui.Designer.vb
index f53cbab..59f04ee 100644
--- a/WinNUT_V2/WinNUT-Client/List_Var_Gui.Designer.vb
+++ b/WinNUT_V2/WinNUT-Client/List_Var_Gui.Designer.vb
@@ -33,10 +33,11 @@ Partial Class List_Var_Gui
Me.Lbl_V = New System.Windows.Forms.Label()
Me.Lbl_Name = New System.Windows.Forms.Label()
Me.Btn_Reload = New System.Windows.Forms.Button()
- Me.Btn_Clear = New System.Windows.Forms.Button()
Me.Btn_Close = New System.Windows.Forms.Button()
Me.Timer_Update_List = New System.Windows.Forms.Timer(Me.components)
Me.Btn_Clip = New System.Windows.Forms.Button()
+ Me.ToolTip = New System.Windows.Forms.ToolTip(Me.components)
+ Me.Btn_Save = New System.Windows.Forms.Button()
Me.GB1.SuspendLayout()
Me.SuspendLayout()
'
@@ -96,18 +97,14 @@ Partial Class List_Var_Gui
'
resources.ApplyResources(Me.Btn_Reload, "Btn_Reload")
Me.Btn_Reload.Name = "Btn_Reload"
+ Me.ToolTip.SetToolTip(Me.Btn_Reload, resources.GetString("Btn_Reload.ToolTip"))
Me.Btn_Reload.UseVisualStyleBackColor = True
'
- 'Btn_Clear
- '
- resources.ApplyResources(Me.Btn_Clear, "Btn_Clear")
- Me.Btn_Clear.Name = "Btn_Clear"
- Me.Btn_Clear.UseVisualStyleBackColor = True
- '
'Btn_Close
'
resources.ApplyResources(Me.Btn_Close, "Btn_Close")
Me.Btn_Close.Name = "Btn_Close"
+ Me.ToolTip.SetToolTip(Me.Btn_Close, resources.GetString("Btn_Close.ToolTip"))
Me.Btn_Close.UseVisualStyleBackColor = True
'
'Timer_Update_List
@@ -116,17 +113,27 @@ Partial Class List_Var_Gui
'
'Btn_Clip
'
+ Me.Btn_Clip.Image = Global.WinNUT_Client.My.Resources.Resources.CopyHS
resources.ApplyResources(Me.Btn_Clip, "Btn_Clip")
Me.Btn_Clip.Name = "Btn_Clip"
+ Me.ToolTip.SetToolTip(Me.Btn_Clip, resources.GetString("Btn_Clip.ToolTip"))
Me.Btn_Clip.UseVisualStyleBackColor = True
'
+ 'Btn_Save
+ '
+ Me.Btn_Save.Image = Global.WinNUT_Client.My.Resources.Resources.saveHS
+ resources.ApplyResources(Me.Btn_Save, "Btn_Save")
+ Me.Btn_Save.Name = "Btn_Save"
+ Me.ToolTip.SetToolTip(Me.Btn_Save, resources.GetString("Btn_Save.ToolTip"))
+ Me.Btn_Save.UseVisualStyleBackColor = True
+ '
'List_Var_Gui
'
resources.ApplyResources(Me, "$this")
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.Controls.Add(Me.Btn_Save)
Me.Controls.Add(Me.Btn_Clip)
Me.Controls.Add(Me.Btn_Close)
- Me.Controls.Add(Me.Btn_Clear)
Me.Controls.Add(Me.Btn_Reload)
Me.Controls.Add(Me.GB1)
Me.Controls.Add(Me.TView_UPSVar)
@@ -148,8 +155,9 @@ Partial Class List_Var_Gui
Friend WithEvents Lbl_V As Label
Friend WithEvents Lbl_Name As Label
Friend WithEvents Btn_Reload As Button
- Friend WithEvents Btn_Clear As Button
Friend WithEvents Btn_Close As Button
Friend WithEvents Timer_Update_List As Timer
Friend WithEvents Btn_Clip As Button
+ Friend WithEvents ToolTip As ToolTip
+ Private WithEvents Btn_Save As Button
End Class
diff --git a/WinNUT_V2/WinNUT-Client/List_Var_Gui.de-DE.resx b/WinNUT_V2/WinNUT-Client/List_Var_Gui.de-DE.resx
index f0364d1..4d3aaed 100644
--- a/WinNUT_V2/WinNUT-Client/List_Var_Gui.de-DE.resx
+++ b/WinNUT_V2/WinNUT-Client/List_Var_Gui.de-DE.resx
@@ -27,9 +27,6 @@
Neu laden
-
- Leeren
-
Schließen
@@ -39,4 +36,25 @@
Liste der USV-Variablen
+
+ ImageBeforeText
+
+
+ 197, 300
+
+
+ 75, 23
+
+
+ 6
+
+
+ ImageBeforeText
+
+
+ 168, 17
+
+
+ 62
+
\ No newline at end of file
diff --git a/WinNUT_V2/WinNUT-Client/List_Var_Gui.fr-FR.resx b/WinNUT_V2/WinNUT-Client/List_Var_Gui.fr-FR.resx
index 7056db5..e9828d4 100644
--- a/WinNUT_V2/WinNUT-Client/List_Var_Gui.fr-FR.resx
+++ b/WinNUT_V2/WinNUT-Client/List_Var_Gui.fr-FR.resx
@@ -27,9 +27,6 @@
Recharger
-
- Vider
-
Fermer
@@ -39,4 +36,25 @@
Liste des Variables de L'UPS
+
+ ImageBeforeText
+
+
+ 197, 300
+
+
+ 75, 23
+
+
+ 6
+
+
+ ImageBeforeText
+
+
+ 168, 17
+
+
+ 62
+
\ No newline at end of file
diff --git a/WinNUT_V2/WinNUT-Client/List_Var_Gui.resx b/WinNUT_V2/WinNUT-Client/List_Var_Gui.resx
index 45e039b..fcf44c3 100644
--- a/WinNUT_V2/WinNUT-Client/List_Var_Gui.resx
+++ b/WinNUT_V2/WinNUT-Client/List_Var_Gui.resx
@@ -140,102 +140,6 @@
5
-
- Lbl_D_Value
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- GB1
-
-
- 0
-
-
- Lbl_V_Value
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- GB1
-
-
- 1
-
-
- Lbl_N_Value
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- GB1
-
-
- 2
-
-
- Lbl_D
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- GB1
-
-
- 3
-
-
- Lbl_V
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- GB1
-
-
- 4
-
-
- Lbl_Name
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- GB1
-
-
- 5
-
-
- 6, 182
-
-
- 360, 110
-
-
- 1
-
-
- Item Properties
-
-
- GB1
-
-
- System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- $this
-
-
- 4
-
True
@@ -249,7 +153,7 @@
250, 15
- 5
+ 3
Lbl_D_Value
@@ -276,7 +180,7 @@
250, 15
- 4
+ 2
Lbl_V_Value
@@ -303,7 +207,7 @@
250, 15
- 3
+ 1
Lbl_N_Value
@@ -398,6 +302,30 @@
5
+
+ 6, 182
+
+
+ 360, 110
+
+
+ 1
+
+
+ Item Properties
+
+
+ GB1
+
+
+ System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 4
+
9, 300
@@ -405,11 +333,17 @@
75, 23
- 2
+ 4
Reload
+
+ 168, 17
+
+
+ Reloads all information from the UPS.
+
Btn_Reload
@@ -422,30 +356,6 @@
3
-
- 102, 300
-
-
- 75, 23
-
-
- 3
-
-
- Clear
-
-
- Btn_Clear
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- $this
-
-
- 2
-
289, 300
@@ -453,11 +363,14 @@
75, 23
- 4
+ 7
Close
+
+ Close this form.
+
Btn_Close
@@ -468,13 +381,13 @@
$this
- 1
+ 2
17, 17
- 197, 300
+ 102, 300
75, 23
@@ -485,6 +398,13 @@
Copy
+
+
+ ImageBeforeText
+
+
+ Copy all information to the Clipboard.
+
Btn_Clip
@@ -495,11 +415,44 @@
$this
+ 1
+
+
+ 197, 300
+
+
+ 75, 23
+
+
+ 6
+
+
+ Save
+
+
+ ImageBeforeText
+
+
+ Save all information to a file.
+
+
+ Btn_Save
+
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
0
True
+
+ 62
+
6, 13
@@ -515,6 +468,12 @@
System.Windows.Forms.Timer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ToolTip
+
+
+ System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
List_Var_Gui
diff --git a/WinNUT_V2/WinNUT-Client/List_Var_Gui.ru-RU.resx b/WinNUT_V2/WinNUT-Client/List_Var_Gui.ru-RU.resx
index 9ceb59a..f9c3426 100644
--- a/WinNUT_V2/WinNUT-Client/List_Var_Gui.ru-RU.resx
+++ b/WinNUT_V2/WinNUT-Client/List_Var_Gui.ru-RU.resx
@@ -27,9 +27,6 @@
Обновить
-
- Очистить
-
Закрыть
@@ -39,4 +36,25 @@
Список переменных ИБП
+
+ ImageBeforeText
+
+
+ 197, 300
+
+
+ 75, 23
+
+
+ 6
+
+
+ ImageBeforeText
+
+
+ 168, 17
+
+
+ 62
+
\ No newline at end of file
diff --git a/WinNUT_V2/WinNUT-Client/List_Var_Gui.uk-UA.resx b/WinNUT_V2/WinNUT-Client/List_Var_Gui.uk-UA.resx
index e16e91e..01a5643 100644
--- a/WinNUT_V2/WinNUT-Client/List_Var_Gui.uk-UA.resx
+++ b/WinNUT_V2/WinNUT-Client/List_Var_Gui.uk-UA.resx
@@ -27,9 +27,6 @@
Оновити
-
- Очистити
-
Закрити
@@ -39,4 +36,25 @@
Список змінних ДБЖ
+
+ ImageBeforeText
+
+
+ 197, 300
+
+
+ 75, 23
+
+
+ 6
+
+
+ ImageBeforeText
+
+
+ 168, 17
+
+
+ 62
+
\ No newline at end of file
diff --git a/WinNUT_V2/WinNUT-Client/List_Var_Gui.vb b/WinNUT_V2/WinNUT-Client/List_Var_Gui.vb
index 34d4de5..3bd238c 100644
--- a/WinNUT_V2/WinNUT-Client/List_Var_Gui.vb
+++ b/WinNUT_V2/WinNUT-Client/List_Var_Gui.vb
@@ -1,13 +1,4 @@
-' WinNUT-Client is a NUT windows client for monitoring your ups hooked up to your favorite linux server.
-' Copyright (C) 2019-2021 Gawindx (Decaux Nicolas)
-'
-' This program is free software: you can redistribute it and/or modify it under the terms of the
-' GNU General Public License as published by the Free Software Foundation, either version 3 of the
-' License, or any later version.
-'
-' This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY
-
-Imports WinNUT_Client_Common
+Imports WinNUT_Client_Common
Public Class List_Var_Gui
Private List_Var_Datas As List(Of UPS_List_Datas)
@@ -76,12 +67,7 @@ Public Class List_Var_Gui
Next
Next
End Sub
- Private Sub Btn_Clear_Click(sender As Object, e As EventArgs) Handles Btn_Clear.Click
- TView_UPSVar.CollapseAll()
- Lbl_N_Value.Text = ""
- Lbl_V_Value.Text = ""
- Lbl_D_Value.Text = ""
- End Sub
+
Private Function FindNodeByValue(ByVal value As String, ByVal nodes As TreeNodeCollection) As TreeNode
For Each n As TreeNode In nodes
If n.Text = value Then
@@ -148,17 +134,73 @@ Public Class List_Var_Gui
End If
End Sub
- Private Sub Btn_Clip_Click(sender As Object, e As EventArgs) Handles Btn_Clip.Click
- LogFile.LogTracing("Export TreeView To Clipboard", LogLvl.LOG_DEBUG, Me)
- Dim ToClipBoard As String = Nothing
+ Private Function SerializeUPSData() As String
+ LogFile.LogTracing("Serializing UPS data to String.", LogLvl.LOG_DEBUG, Me)
+ Dim sb As New Text.StringBuilder()
+
With WinNUT.UPS_Device.UPS_Datas
- ToClipBoard = My.Settings.NUT_UPSName & " (" & .Mfr & "/" & .Model & "/" & .Firmware & ")" & vbNewLine
+ sb.AppendLine(UPSDevice.Name & " (" & .Mfr & "/" & .Model & "/" & .Firmware & ")")
End With
+
For Each LDatas In List_Var_Datas
- ToClipBoard &= LDatas.VarKey & " (" & LDatas.VarDesc & ") : " & LDatas.VarValue & vbNewLine
+ sb.AppendLine(LDatas.VarKey & " (" & LDatas.VarDesc & ") : " & LDatas.VarValue)
Next
- My.Computer.Clipboard.SetText(ToClipboard)
+
+ LogFile.LogTracing("Successfully built serialized string, length: " & sb.Length, LogLvl.LOG_DEBUG, Me)
+ Return sb.ToString()
+ End Function
+
+ Private Sub Btn_Clip_Click(sender As Object, e As EventArgs) Handles Btn_Clip.Click
+ LogFile.LogTracing("Copy TreeView To Clipboard", LogLvl.LOG_DEBUG, Me)
+
+ Try
+ Clipboard.SetText(SerializeUPSData)
+ LogFile.LogTracing("Successfully copied UPS information to the Clipboard.", LogLvl.LOG_NOTICE, Me,
+ My.Resources.List_Var_Gui__SetCpbTextSuccess)
+
+ Catch ex As Exception
+ Dim frmtdError = String.Format(My.Resources.List_Var_Gui__SetCpbTextError_Text, ex.Message)
+ LogFile.LogTracing("Exception encountered while attempting to set Clipboard text.", LogLvl.LOG_ERROR, Me,
+ frmtdError)
+ LogFile.LogException(ex, Me)
+ MessageBox.Show(frmtdError, My.Resources.List_Var_Gui__SetCpbTextError_Caption,
+ MessageBoxButtons.OK, MessageBoxIcon.Error)
+ End Try
End Sub
+
+ Private Sub Btn_Save_Click(sender As Object, e As EventArgs) Handles Btn_Save.Click
+ LogFile.LogTracing("Export TreeView To File", LogLvl.LOG_DEBUG, Me)
+
+ Dim sfd As New SaveFileDialog With {
+ .Filter = "Text files|*.txt|All files|*.*",
+ .InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
+ .Title = My.Resources.List_Var_Gui__SaveFile_Caption
+ }
+ Dim dialogRes = sfd.ShowDialog()
+
+ If dialogRes = DialogResult.OK AndAlso sfd.FileName <> String.Empty Then
+ LogFile.LogTracing("User completed SaveFileDialog, path: " & sfd.FileName, LogLvl.LOG_NOTICE, Me)
+ Try
+ Using sw As New IO.StreamWriter(sfd.OpenFile())
+ sw.Write(SerializeUPSData)
+ sw.Close()
+ LogFile.LogTracing("File saved successfully.", LogLvl.LOG_NOTICE, Me,
+ String.Format(My.Resources.List_Var_Gui__SaveFileSuccess, sfd.FileName))
+ End Using
+
+ Catch ex As Exception
+ Dim frmtdError = String.Format(My.Resources.List_Var_Gui__SaveFileError_Text, ex.Message)
+ LogFile.LogTracing("Exception encountered while saving UPS data to a file.", LogLvl.LOG_ERROR, Me,
+ frmtdError)
+ LogFile.LogException(ex, Me)
+ MessageBox.Show(frmtdError, My.Resources.List_Var_Gui__SaveFile_Caption,
+ MessageBoxButtons.OK, MessageBoxIcon.Error)
+ End Try
+ Else
+ LogFile.LogTracing("SaveFileDialog was not accepted.", LogLvl.LOG_NOTICE, Me)
+ End If
+ End Sub
+
Function GetChildren(parentNode As TreeNode) As List(Of String)
Dim nodes As List(Of String) = New List(Of String)
GetAllChildren(parentNode, nodes)
diff --git a/WinNUT_V2/WinNUT-Client/List_Var_Gui.zh-CN.resx b/WinNUT_V2/WinNUT-Client/List_Var_Gui.zh-CN.resx
index 6602d44..9307f84 100644
--- a/WinNUT_V2/WinNUT-Client/List_Var_Gui.zh-CN.resx
+++ b/WinNUT_V2/WinNUT-Client/List_Var_Gui.zh-CN.resx
@@ -27,9 +27,6 @@
重载
-
- 清空
-
关闭
@@ -39,4 +36,25 @@
UPS变量列表
+
+ ImageBeforeText
+
+
+ 197, 300
+
+
+ 75, 23
+
+
+ 6
+
+
+ ImageBeforeText
+
+
+ 168, 17
+
+
+ 62
+
\ No newline at end of file
diff --git a/WinNUT_V2/WinNUT-Client/List_Var_Gui.zh-TW.resx b/WinNUT_V2/WinNUT-Client/List_Var_Gui.zh-TW.resx
index e58d7d3..c1d1321 100644
--- a/WinNUT_V2/WinNUT-Client/List_Var_Gui.zh-TW.resx
+++ b/WinNUT_V2/WinNUT-Client/List_Var_Gui.zh-TW.resx
@@ -27,9 +27,6 @@
重新載入
-
- 清除
-
關閉
@@ -39,4 +36,25 @@
UPS 變數清單
+
+ ImageBeforeText
+
+
+ 197, 300
+
+
+ 75, 23
+
+
+ 6
+
+
+ ImageBeforeText
+
+
+ 168, 17
+
+
+ 62
+
\ No newline at end of file
diff --git a/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-Client.zh-TW.xlf b/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-Client.zh-TW.xlf
index db819aa..ed3220d 100644
--- a/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-Client.zh-TW.xlf
+++ b/WinNUT_V2/WinNUT-Client/MultilingualResources/WinNUT-Client.zh-TW.xlf
@@ -157,8 +157,8 @@ Remaining Time : {WinNUT.Lbl_VRTime.Text}
250, 15
- 5
- 5
+ 3
+ 3
True
@@ -177,8 +177,8 @@ Remaining Time : {WinNUT.Lbl_VRTime.Text}
250, 15
- 4
- 4
+ 2
+ 2
True
@@ -197,8 +197,8 @@ Remaining Time : {WinNUT.Lbl_VRTime.Text}
250, 15
- 3
- 3
+ 1
+ 1
True
@@ -269,29 +269,13 @@ Remaining Time : {WinNUT.Lbl_VRTime.Text}
75, 23
- 2
- 2
+ 4
+ 4
Reload
重新載入
-
- 102, 300
- 102, 300
-
-
- 75, 23
- 75, 23
-
-
- 3
- 3
-
-
- Clear
- 清除
-
289, 300
289, 300
@@ -301,16 +285,16 @@ Remaining Time : {WinNUT.Lbl_VRTime.Text}
75, 23
- 4
- 4
+ 7
+ 7
Close
關閉
- 197, 300
- 197, 300
+ 102, 300
+ 102, 300
75, 23
@@ -344,6 +328,54 @@ Remaining Time : {WinNUT.Lbl_VRTime.Text}
True
True
+
+ ImageBeforeText
+ ImageBeforeText
+
+
+ Copy all information to the Clipboard.
+ Copy all information to the Clipboard.
+
+
+ 197, 300
+ 197, 300
+
+
+ 75, 23
+ 75, 23
+
+
+ 6
+ 6
+
+
+ Save
+ Save
+
+
+ ImageBeforeText
+ ImageBeforeText
+
+
+ Save all information to a file.
+ Save all information to a file.
+
+
+ 168, 17
+ 168, 17
+
+
+ 62
+ 62
+
+
+ Reloads all information from the UPS.
+ Reloads all information from the UPS.
+
+
+ Close this form.
+ Close this form.
+