温湿度传感器更新
现在可以手动更新温湿度了
This commit is contained in:
35
Mods/工业数据采集与分析应用分享/Scripts/IDIS_UpdateService.cs
Normal file
35
Mods/工业数据采集与分析应用分享/Scripts/IDIS_UpdateService.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using BITFactory;
|
||||
|
||||
public partial class IDIS_UpdateService : Node
|
||||
{
|
||||
[ExportCategory("Services")]
|
||||
[Export] private IDIS_Service service;
|
||||
|
||||
[ExportCategory("UI 绑定")]
|
||||
[Export] private Button submitButton;
|
||||
[Export] private LineEdit handleEdit;
|
||||
[Export] private LineEdit temperatureEdit;
|
||||
[Export] private LineEdit humidityEdit;
|
||||
[Export] private Label hintsLabel;
|
||||
public override void _Ready()
|
||||
{
|
||||
submitButton.Pressed += Submit;
|
||||
}
|
||||
private void Submit()
|
||||
{
|
||||
try
|
||||
{
|
||||
service.Update(handleEdit.Text, "温度", humidityEdit.Text);
|
||||
service.Update(handleEdit.Text, "湿度", temperatureEdit.Text);
|
||||
hintsLabel.Text = "更新成功: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
hintsLabel.Text = e.Message;
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user