添加了标识更新
但是只有界面没有功能
This commit is contained in:
@@ -60,8 +60,8 @@ public partial class IDIS_RegisterService : Node
|
||||
|
||||
private void OnItemClicked(long index, Vector2 atPosition, long mouseButtonIndex)
|
||||
{
|
||||
MathNode.RemoveAllChild(registerContainer);
|
||||
MathNode.RemoveAllChild(referenceContainer);
|
||||
MathNode.ClearChild(registerContainer);
|
||||
MathNode.ClearChild(referenceContainer);
|
||||
|
||||
var template = templateService.templates[(int)index];
|
||||
|
||||
@@ -153,6 +153,7 @@ public partial class IDIS_RegisterService : Node
|
||||
registerProgress.Visible = false;
|
||||
registerButton.Disabled = false;
|
||||
hints.Text = "注册成功";
|
||||
tween.Stop();
|
||||
};
|
||||
tween.Play();
|
||||
|
||||
|
@@ -32,15 +32,20 @@ public partial class IDIS_SearchService : Node
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
MathNode.RemoveAllChild(searchCandidateContainer);
|
||||
MathNode.RemoveAllChild(valueContainer);
|
||||
MathNode.ClearChild(searchCandidateContainer);
|
||||
MathNode.ClearChild(valueContainer);
|
||||
|
||||
searchEdit.TextChanged += Search;
|
||||
//searchEdit.FocusExited += Clear;
|
||||
}
|
||||
|
||||
private void Search()
|
||||
{
|
||||
Search(searchEdit.Text);
|
||||
}
|
||||
private void Search(string word)
|
||||
{
|
||||
MathNode.RemoveAllChild(searchCandidateContainer);
|
||||
MathNode.ClearChild(searchCandidateContainer);
|
||||
if (service.Query(word, out IDIS_Query[] queries) is false) return;
|
||||
if(queries.Length is 1 && queries.First().Handle == word)return;
|
||||
foreach (var query in queries)
|
||||
@@ -68,7 +73,7 @@ public partial class IDIS_SearchService : Node
|
||||
private async void Clear()
|
||||
{
|
||||
await Task.Delay(100);
|
||||
MathNode.RemoveAllChild(searchCandidateContainer);
|
||||
MathNode.ClearChild(searchCandidateContainer);
|
||||
}
|
||||
private void QueryIDIS(IDIS_Query query)
|
||||
{
|
||||
@@ -79,8 +84,8 @@ public partial class IDIS_SearchService : Node
|
||||
createTimeLabel.Text = query.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
createTimeLabel.Text = query.UpdateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
MathNode.RemoveAllChild(valueContainer);
|
||||
MathNode.RemoveAllChild(referenceContainer);
|
||||
MathNode.ClearChild(valueContainer);
|
||||
MathNode.ClearChild(referenceContainer);
|
||||
|
||||
foreach (var categoryGroup in query.Datas.GroupBy(x=>x.Category))
|
||||
{
|
||||
|
62
Mods/工业数据采集与分析应用分享/Scripts/IDIS_THService.cs
Normal file
62
Mods/工业数据采集与分析应用分享/Scripts/IDIS_THService.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using BITFactory;
|
||||
|
||||
namespace BITFactory;
|
||||
public partial class IDIS_THService : Node
|
||||
{
|
||||
[ExportCategory("Services")]
|
||||
[Export] private IDIS_Service service;
|
||||
|
||||
[Export] private 温湿度Reader thReader;
|
||||
|
||||
[ExportCategory("UI 绑定")]
|
||||
[Export] private Button submitButton;
|
||||
[Export] private LineEdit handleEdit;
|
||||
[Export] private LineEdit temperatureEdit;
|
||||
[Export] private LineEdit humidityEdit;
|
||||
[Export] private RichTextLabel hintsLabel;
|
||||
public override void _Ready()
|
||||
{
|
||||
submitButton.Pressed += Submit;
|
||||
}
|
||||
private void Submit()
|
||||
{
|
||||
switch (handleEdit.Text, temperatureEdit.Text, humidityEdit.Text)
|
||||
{
|
||||
case ("", _, _):
|
||||
hintsLabel.Text = "请输入标识码";
|
||||
return;
|
||||
case (_, "", _):
|
||||
hintsLabel.Text = "请输入温度";
|
||||
return;
|
||||
case (_, _, ""):
|
||||
hintsLabel.Text = "请输入湿度";
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (service.Update(handleEdit.Text, "温度", humidityEdit.Text) is false)
|
||||
{
|
||||
hintsLabel.Text = "温度更新失败: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
return;
|
||||
}
|
||||
if (service.Update(handleEdit.Text, "湿度", temperatureEdit.Text) is false)
|
||||
{
|
||||
hintsLabel.Text = "湿度更新失败: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
return;
|
||||
}
|
||||
hintsLabel.Text = "更新成功: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
hintsLabel.Text = e.Message;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateByReader()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@@ -62,7 +62,7 @@ public partial class IDIS_TemplateService : Node
|
||||
templateDescriptionEdit.TextChanged += OnTemplateDescriptionChanged;
|
||||
|
||||
|
||||
MathNode.RemoveAllChild(container);
|
||||
MathNode.ClearChild(container);
|
||||
|
||||
EnsureConfigure();
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public partial class IDIS_TemplateService : Node
|
||||
private void EnsureConfigure()
|
||||
{
|
||||
itemList.Clear();
|
||||
MathNode.RemoveAllChild(container);
|
||||
MathNode.ClearChild(container);
|
||||
|
||||
foreach (var x in templates)
|
||||
{
|
||||
|
@@ -1,54 +1,48 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using BITFactory;
|
||||
using BITKit;
|
||||
|
||||
namespace BITFactory;
|
||||
public partial class IDIS_UpdateService : Node
|
||||
{
|
||||
[ExportCategory("Services")]
|
||||
[ExportCategory("Service")]
|
||||
[Export] private IDIS_Service service;
|
||||
|
||||
[Export] private IDIS_TemplateService templateService;
|
||||
|
||||
[ExportCategory("UI 绑定")]
|
||||
[Export] private Button submitButton;
|
||||
[Export] private NodeBuilder indexBuilder;
|
||||
[Export] private NodeBuilder templateBuilder;
|
||||
[Export] private LineEdit handleEdit;
|
||||
[Export] private LineEdit temperatureEdit;
|
||||
[Export] private LineEdit humidityEdit;
|
||||
[Export] private RichTextLabel hintsLabel;
|
||||
|
||||
private ButtonGroup _buttonGroup;
|
||||
public override void _Ready()
|
||||
{
|
||||
submitButton.Pressed += Submit;
|
||||
_buttonGroup = new ButtonGroup();
|
||||
Refresh();
|
||||
}
|
||||
private void Submit()
|
||||
|
||||
private void Refresh()
|
||||
{
|
||||
switch (handleEdit.Text, temperatureEdit.Text, humidityEdit.Text)
|
||||
templateBuilder.Clear();
|
||||
indexBuilder.Clear();
|
||||
foreach (var x in templateService.templates)
|
||||
{
|
||||
case ("", _, _):
|
||||
hintsLabel.Text = "请输入标识码";
|
||||
return;
|
||||
case (_, "", _):
|
||||
hintsLabel.Text = "请输入温度";
|
||||
return;
|
||||
case (_, _, ""):
|
||||
hintsLabel.Text = "请输入湿度";
|
||||
return;
|
||||
var container = indexBuilder.Build<UXContainer>();
|
||||
container.button.Text = x.TemplateName;
|
||||
container.button.ButtonPressed = true;
|
||||
container.button.ButtonGroup = _buttonGroup;
|
||||
container.button.Pressed +=()=> Entry(x);
|
||||
}
|
||||
try
|
||||
}
|
||||
private void Entry(IDIS_Template template)
|
||||
{
|
||||
templateBuilder.Clear();
|
||||
foreach (var x in template.Formats)
|
||||
{
|
||||
if (service.Update(handleEdit.Text, "温度", humidityEdit.Text) is false)
|
||||
{
|
||||
hintsLabel.Text = "温度更新失败: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
return;
|
||||
}
|
||||
if (service.Update(handleEdit.Text, "湿度", temperatureEdit.Text) is false)
|
||||
{
|
||||
hintsLabel.Text = "湿度更新失败: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
return;
|
||||
}
|
||||
hintsLabel.Text = "更新成功: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
hintsLabel.Text = e.Message;
|
||||
throw;
|
||||
var container = templateBuilder.Build<UXContainer>();
|
||||
container.Text = x.format;
|
||||
container.lineEdit.PlaceholderText = x.hint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user