Agregar archivos de proyecto.
This commit is contained in:
26
sistema.vb
Normal file
26
sistema.vb
Normal file
@@ -0,0 +1,26 @@
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Reflection
|
||||
|
||||
Public Class sistema
|
||||
Public Shared Function EstadoBateria() As String
|
||||
Try
|
||||
Dim t As Type = GetType(System.Windows.Forms.PowerStatus)
|
||||
Dim pi As PropertyInfo() = t.GetProperties()
|
||||
Dim i As Integer
|
||||
Dim sEstado As String = ""
|
||||
For i = 0 To pi.Length - 1
|
||||
Dim propval As Object = pi(i).GetValue(SystemInformation.PowerStatus, Nothing)
|
||||
sEstado &= pi(i).Name & " = " & propval.ToString & vbCrLf
|
||||
Next i
|
||||
Return sEstado
|
||||
Catch ex As Exception
|
||||
Throw
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function PorcentajeBateria() As Integer
|
||||
Dim power As PowerStatus = SystemInformation.PowerStatus
|
||||
Dim percent As Single = power.BatteryLifePercent * 100
|
||||
Return percent
|
||||
End Function
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user