0

我对编程很陌生,我正在尝试在 Windows 的小树莓派面板上创建自定义屏幕监控。

为此,我正在使用 Visual Studio 2019,我希望在 vb.net 中对其进行编码(我知道一点)。

所以我正在尝试使用 openhardwaremonitor dll OpenHardwareMonitorLib.dll 访问系统传感器

我成功访问了一些传感器,但我不知道我真正访问的是什么,是否有一些关于图书馆的文档?我没有成功寻找它。

这是我现在的位置:

''' 公开课Form1

Public Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


End Sub

Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    Timer1.Interval = 100
    Timer1.Enabled = True
    Timer1.Start()


End Sub


Private Sub Timer1_Tick(sender As Object, e As System.EventArgs) Handles Timer1.tick
    Dim cputemperature1 As String
    Dim cputemperature2 As String
    Dim cputemperature3 As String
    Dim cputemperature4 As String
    Dim cputemperature5 As String
    Dim cputemperature6 As String
    Dim cputemperature7 As String
    Dim cputemperature8 As String
    Dim cputemperature9 As String
    Dim computer As New Computer()

    computer.Open()
    computer.CPUEnabled = True
    computer.GPUEnabled = True


    Dim cpu = computer.Hardware.Where(Function(h) h.HardwareType = HardwareType.CPU).FirstOrDefault()

    If cpu IsNot Nothing Then
        cpu.Update()
    End If


    Dim tempSensors = cpu.Sensors.Where(Function(s) s.SensorType = SensorType.Temperature)



    cputemperature1 = tempSensors.ToList.Item(0).Value
    cputemperature2 = tempSensors.ToList.Item(1).Value
    cputemperature3 = tempSensors.ToList.Item(2).Value
    cputemperature4 = tempSensors.ToList.Item(3).Value
    cputemperature5 = tempSensors.ToList.Item(4).Value
    cputemperature6 = tempSensors.ToList.Item(5).Value
    cputemperature7 = tempSensors.ToList.Item(6).Value
    cputemperature8 = tempSensors.ToList.Item(7).Value
    cputemperature9 = tempSensors.ToList.Item(8).Value

    Label1.Text = cputemperature1
    Label2.Text = cputemperature2
    Label3.Text = cputemperature3
    Label4.Text = cputemperature4
    Label5.Text = cputemperature5
    Label5.Text = cputemperature6
    Label7.Text = cputemperature7
    Label8.Text = cputemperature8
    Label9.Text = cputemperature9
End Sub

结束类 '''

我用我在网上找到的东西自己做的。但我什至不确定那些“tempSensors.ToList.Item(8).Value”指的是哪些传感器。

感谢您的帮助

4

0 回答 0