Before update to NET 7
This commit is contained in:
parent
ca824c3b32
commit
4af7cec47b
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dey6r76kttak6"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dey6r76kttak6"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://d1uver224k3px" path="res://addons/ui_design_tool/assets/icons/folder_open-white-18dp.svg" id="1_jbnj1"]
|
||||
[ext_resource type="Texture2D" uid="uid://dn7q7grbfr7kh" path="res://addons/ui_design_tool/assets/icons/refresh-white-18dp.svg" id="1_miiu5"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_uocfi"]
|
||||
bg_color = Color(0.156863, 0.152941, 0.172549, 1)
|
||||
|
@ -35,7 +36,13 @@ text = "按钮"
|
|||
[node name="Button3" type="Button" parent="Scroll/HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"ColorPanel"
|
||||
text = "按钮 ColorPanel"
|
||||
|
||||
[node name="Button5" type="Button" parent="Scroll/HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "按钮"
|
||||
icon = ExtResource("1_miiu5")
|
||||
alignment = 0
|
||||
|
||||
[node name="Button4" type="Button" parent="Scroll/HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BITKit;
|
||||
|
||||
public interface IDatabaseContext<T> where T : class
|
||||
{
|
||||
void Add(T entity);
|
||||
UniTask AddAsync(T entity);
|
||||
void Remove(T entity);
|
||||
T[] GetArray();
|
||||
bool TrySearch(Func<T, bool> searchFactory, out T result);
|
||||
bool TrySearchArray(Func<T, bool> searchFactory, out T[] result);
|
||||
}
|
||||
|
||||
public abstract class EntityFrameworkContext<T>:DbContext ,IDatabaseContext<T> where T : class
|
||||
{
|
||||
protected DbSet<T> context { get; private set; }
|
||||
|
||||
public void Add(T entity)
|
||||
{
|
||||
context.Add(entity);
|
||||
SaveChanges();
|
||||
}
|
||||
|
||||
public async UniTask AddAsync(T entity)
|
||||
{
|
||||
await context.AddAsync(entity);
|
||||
await SaveChangesAsync();
|
||||
}
|
||||
|
||||
public void Remove(T entity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public T[] GetArray()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool TrySearch(Func<T, bool> searchFactory, out T result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool TrySearchArray(Func<T, bool> searchFactory, out T[] result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Console;
|
||||
|
||||
namespace BITKit;
|
||||
|
||||
public class MySQLContext<T>:DbContext where T:class
|
||||
{
|
||||
protected readonly string _connectSql;
|
||||
protected DbSet<T> context { get; private set; }
|
||||
public MySQLContext(string connectSql) : base()
|
||||
{
|
||||
_connectSql = connectSql;
|
||||
}
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseMySQL("_connectSql");
|
||||
}
|
||||
}
|
|
@ -4,14 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
|||
|
||||
namespace BITKit;
|
||||
|
||||
public interface IDatabaseContext<T> where T : class
|
||||
{
|
||||
void Add(T entity);
|
||||
void Remove(T entity);
|
||||
T[] GetArray();
|
||||
bool TrySearch(Func<T, bool> searchFactory, out T result);
|
||||
bool TrySearchArray(Func<T, bool> searchFactory, out T[] result);
|
||||
}
|
||||
|
||||
|
||||
public class SqlLiteContext<T> : DbContext,IDatabaseContext<T> where T : class
|
||||
{
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
using Cysharp.Threading.Tasks;
|
||||
using Godot;
|
||||
|
||||
namespace BITKit;
|
||||
|
||||
public static class LabelExtensions
|
||||
{
|
||||
public static async void SetTextAsync(this Label self, string text)
|
||||
{
|
||||
await UniTask.SwitchToSynchronizationContext(BITApp.SynchronizationContext);
|
||||
self.Text = text;
|
||||
}
|
||||
public static async void SetTextAsync(this RichTextLabel self,string text)
|
||||
{
|
||||
await UniTask.SwitchToSynchronizationContext(BITApp.SynchronizationContext);
|
||||
self.Text = text;
|
||||
}
|
||||
}
|
|
@ -11,11 +11,9 @@ public partial class IDIS_RegisterService : Node
|
|||
[ExportCategory("Services")]
|
||||
[Export] private IDIS_Service service;
|
||||
[Export] private IDIS_TemplateService templateService;
|
||||
|
||||
[ExportCategory("TemplateList")]
|
||||
[Export] private ItemList templateList;
|
||||
|
||||
[ExportCategory("Register Data")]
|
||||
|
||||
[ExportCategory("UI 绑定")]
|
||||
[Export] private NodeBuilder templateIndexBuilder;
|
||||
[Export] private LineEdit handleEdit;
|
||||
[Export] private Button generateHandleButton;
|
||||
[Export] private Control registerContainer;
|
||||
|
@ -34,8 +32,6 @@ public partial class IDIS_RegisterService : Node
|
|||
|
||||
public override void _Ready()
|
||||
{
|
||||
templateList.ItemClicked += OnItemClicked;
|
||||
|
||||
registerButton.Pressed += Register;
|
||||
|
||||
generateHandleButton.Pressed += ()=>handleEdit.Text = IDIS_Service.GenerateHandle();
|
||||
|
@ -51,21 +47,20 @@ public partial class IDIS_RegisterService : Node
|
|||
private void Rebuild()
|
||||
{
|
||||
if (Engine.IsEditorHint()) return;
|
||||
templateList.Clear();
|
||||
templateIndexBuilder.Clear();
|
||||
foreach (var x in templateService.templates)
|
||||
{
|
||||
templateList.AddItem(x.TemplateName);
|
||||
var container = templateIndexBuilder.Build<UXContainer>();
|
||||
container.button.Text = x.TemplateName;
|
||||
container.button.Pressed += () =>
|
||||
{
|
||||
OnItemClicked(x);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void OnItemClicked(long index, Vector2 atPosition, long mouseButtonIndex)
|
||||
private void OnItemClicked(IDIS_Template template)
|
||||
{
|
||||
MathNode.ClearChild(registerContainer);
|
||||
MathNode.ClearChild(referenceContainer);
|
||||
|
||||
var template = templateService.templates[(int)index];
|
||||
|
||||
|
||||
var grid = new GridContainer();
|
||||
grid.Columns = 2;
|
||||
grid.AddThemeConstantOverride("h_separation", 64);
|
||||
|
|
|
@ -179,7 +179,7 @@ public class IDIS_DBContext:DbContext
|
|||
Handle = handle
|
||||
};
|
||||
Values.Add(value);
|
||||
SaveChanges();
|
||||
SaveChangesAsync();
|
||||
return true;
|
||||
}
|
||||
public void Register(string handle,string format, string value,string category)
|
||||
|
@ -197,7 +197,7 @@ public class IDIS_DBContext:DbContext
|
|||
Category = category,
|
||||
};
|
||||
Datas.Add(data);
|
||||
SaveChanges();
|
||||
SaveChangesAsync();
|
||||
}
|
||||
|
||||
public void RegisterReference(string handle, string refenceHandle)
|
||||
|
@ -207,19 +207,17 @@ public class IDIS_DBContext:DbContext
|
|||
Handle = handle,
|
||||
RelatedHandle = refenceHandle,
|
||||
});
|
||||
SaveChanges();
|
||||
SaveChangesAsync();
|
||||
}
|
||||
|
||||
public bool Update(string handle, string format, string value)
|
||||
{
|
||||
var result = Datas.FirstOrDefault(x => x.Handle == handle && x.Format == format);
|
||||
if (result is not null)
|
||||
{
|
||||
result.UpdateTime=DateTime.Now;
|
||||
result.Value = value;
|
||||
SaveChanges();
|
||||
}
|
||||
return result is not null;
|
||||
if (result is null) return false;
|
||||
result.UpdateTime=DateTime.Now;
|
||||
result.Value = value;
|
||||
SaveChangesAsync();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// ReSharper disable once IdentifierTypo
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Timers;
|
||||
using BITFactory;
|
||||
using BITKit;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
namespace BITFactory;
|
||||
public partial class IDIS_THService : Node
|
||||
|
@ -12,14 +18,38 @@ public partial class IDIS_THService : Node
|
|||
|
||||
[ExportCategory("UI 绑定")]
|
||||
[Export] private Button submitButton;
|
||||
[Export] private CheckButton autoUpdateButton;
|
||||
[Export] private LineEdit handleEdit;
|
||||
[Export] private LineEdit temperatureEdit;
|
||||
[Export] private LineEdit humidityEdit;
|
||||
[Export] private RichTextLabel hintsLabel;
|
||||
[Export] private RichTextLabel autoUpdateLabel;
|
||||
|
||||
private Timer autoUpdateTimer;
|
||||
public override void _Ready()
|
||||
{
|
||||
submitButton.Pressed += Submit;
|
||||
autoUpdateButton.Toggled += toggle =>
|
||||
{
|
||||
submitButton.Disabled = toggle;
|
||||
handleEdit.Editable = !toggle;
|
||||
temperatureEdit.Editable = !toggle;
|
||||
humidityEdit.Editable = !toggle;
|
||||
autoUpdateTimer.Enabled = toggle;
|
||||
};
|
||||
|
||||
autoUpdateTimer = new Timer();
|
||||
autoUpdateTimer.AutoReset = true;
|
||||
autoUpdateTimer.Interval = 1000;
|
||||
autoUpdateTimer.Elapsed += AutoUpdate;
|
||||
}
|
||||
|
||||
private async void AutoUpdate(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
await UniTask.SwitchToSynchronizationContext(BITApp.SynchronizationContext);
|
||||
UpdateByReader();
|
||||
}
|
||||
|
||||
private void Submit()
|
||||
{
|
||||
switch (handleEdit.Text, temperatureEdit.Text, humidityEdit.Text)
|
||||
|
@ -57,6 +87,21 @@ public partial class IDIS_THService : Node
|
|||
|
||||
private void UpdateByReader()
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(handleEdit.Text))
|
||||
{
|
||||
autoUpdateLabel.SetTextAsync("空的标识码");
|
||||
return;
|
||||
}
|
||||
if (service.Update(handleEdit.Text, "温度", thReader.temperature.ToString(CultureInfo.InvariantCulture)) is false)
|
||||
{
|
||||
autoUpdateLabel.SetTextAsync("温度更新失败,未知异常");
|
||||
return;
|
||||
}
|
||||
if (service.Update(handleEdit.Text, "湿度", thReader.humidity.ToString(CultureInfo.InvariantCulture)) is false)
|
||||
{
|
||||
autoUpdateLabel.SetTextAsync("湿度更新失败,未知异常");
|
||||
return;
|
||||
}
|
||||
autoUpdateLabel.SetTextAsync($"温湿度已自动更新:{DateTime.Now}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using BITKit;
|
||||
using BITKit.IO;
|
||||
using RosSharp.RosBridgeClient.MessageTypes.Moveit;
|
||||
using Godot;
|
||||
|
||||
namespace BITFactory;
|
||||
[Serializable]
|
||||
|
@ -24,11 +22,11 @@ public partial class IDIS_TemplateService : Node
|
|||
private static string assetPath => PathHelper.GetPath("标识注册模板.zip");
|
||||
private const string templateName = $"{nameof(IDIS_Template)}.json";
|
||||
public readonly List<IDIS_Template> templates=new();
|
||||
private readonly Queue<IDIS_Template> selectedQueue = new();
|
||||
|
||||
[ExportCategory("Quick Start")]
|
||||
[Export] private Button createButton;
|
||||
[Export] private Button newFormatButton;
|
||||
[Export] private ItemList itemList;
|
||||
[Export] private NodeBuilder templateIndexBuilder;
|
||||
[Export] private LineEdit templateNameEdit;
|
||||
[Export] private LineEdit templateDescriptionEdit;
|
||||
[Export] private Control container;
|
||||
|
@ -39,13 +37,13 @@ public partial class IDIS_TemplateService : Node
|
|||
|
||||
private bool isDirty;
|
||||
|
||||
private IDIS_Template _selectedTemplate=>_selectedIndex==-1?null:templates[_selectedIndex];
|
||||
private int _selectedIndex=-1;
|
||||
private IDIS_Template _selectedTemplate;
|
||||
public override void _Ready()
|
||||
{
|
||||
if (File.Exists(assetPath) is false)
|
||||
{
|
||||
BIT4Log.Log<IDIS_TemplateService>($"未找到配置文件:{assetPath}");
|
||||
Save();
|
||||
}
|
||||
var temp = BITAssets.Read<List<IDIS_Template>>(assetPath, templateName);
|
||||
|
||||
|
@ -55,9 +53,6 @@ public partial class IDIS_TemplateService : Node
|
|||
createButton.Pressed += CreateTemplate;
|
||||
newFormatButton.Pressed += CreateFormat;
|
||||
|
||||
itemList.ItemSelected += OnItemSelected;
|
||||
itemList.ItemClicked += OnItemClicked;
|
||||
|
||||
templateNameEdit.TextChanged += OnTemplateNameChanged;
|
||||
templateDescriptionEdit.TextChanged += OnTemplateDescriptionChanged;
|
||||
|
||||
|
@ -78,11 +73,7 @@ public partial class IDIS_TemplateService : Node
|
|||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
BITAssets.Build(assetPath,new IAsset[]
|
||||
{
|
||||
new BITAsset(templateName,JsonHelper.Get(templates))
|
||||
});
|
||||
BIT4Log.Log<IDIS_TemplateService>($"已创建配置文件:{assetPath}");
|
||||
Save();
|
||||
}
|
||||
|
||||
private void CreateTemplate()
|
||||
|
@ -93,6 +84,15 @@ public partial class IDIS_TemplateService : Node
|
|||
});
|
||||
EnsureConfigure();
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
BITAssets.Build(assetPath,new IAsset[]
|
||||
{
|
||||
new BITAsset(templateName,JsonHelper.Get(templates))
|
||||
});
|
||||
BIT4Log.Log<IDIS_TemplateService>($"已创建配置文件:{assetPath}");
|
||||
}
|
||||
private void OnTemplateNameChanged(string text)
|
||||
{
|
||||
if (_selectedTemplate is null) return;
|
||||
|
@ -105,70 +105,68 @@ public partial class IDIS_TemplateService : Node
|
|||
_selectedTemplate.TemplateDescription = text;
|
||||
_selectedTemplate.UpdateTime= DateTime.Now;
|
||||
}
|
||||
|
||||
private void EnsureConfigure()
|
||||
{
|
||||
itemList.Clear();
|
||||
MathNode.ClearChild(container);
|
||||
|
||||
templateIndexBuilder.Clear();
|
||||
|
||||
foreach (var x in templates)
|
||||
{
|
||||
itemList.AddItem(x.TemplateName);
|
||||
var _container = templateIndexBuilder.Build<UXContainer>();
|
||||
_container.button.Text = x.TemplateName;
|
||||
_container.button.Pressed += () =>
|
||||
{
|
||||
_selectedTemplate = x;
|
||||
EnsureConfigure();
|
||||
};
|
||||
}
|
||||
|
||||
if (_selectedTemplate is null) return;
|
||||
templateNameEdit.Text=_selectedTemplate.TemplateName;
|
||||
templateDescriptionEdit.Text=_selectedTemplate.TemplateDescription;
|
||||
templateCreateTimeLabel.Text = _selectedTemplate.CreateTime.ToString(CultureInfo.InvariantCulture);
|
||||
templateUpdateTimeLabel.Text = _selectedTemplate.UpdateTime.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
for (var i = 0; i < _selectedTemplate.Formats.Count; i++)
|
||||
templateNameEdit.Text = _selectedTemplate.TemplateName;
|
||||
templateDescriptionEdit.Text = _selectedTemplate.TemplateDescription;
|
||||
templateCreateTimeLabel.Text = _selectedTemplate.CreateTime.ToString(CultureInfo.InvariantCulture);
|
||||
templateUpdateTimeLabel.Text = _selectedTemplate.UpdateTime.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
for (var i = 0; i < _selectedTemplate.Formats.Count; i++)
|
||||
{
|
||||
var x = _selectedTemplate.Formats[i];
|
||||
var _container = templateContainer.Instantiate<UXContainer>();
|
||||
|
||||
_container.lineEdits[0].Text = x.format;
|
||||
_container.lineEdits[1].Text = x.hint;
|
||||
_container.lineEdits[2].Text = x.category;
|
||||
|
||||
var index = i;
|
||||
|
||||
_container.lineEdits[0].TextChanged += (s) =>
|
||||
{
|
||||
var x = _selectedTemplate.Formats[i];
|
||||
var _container = templateContainer.Instantiate<UXContainer>();
|
||||
|
||||
_container.lineEdits[0].Text = x.format;
|
||||
_container.lineEdits[1].Text = x.hint;
|
||||
_container.lineEdits[2].Text = x.category;
|
||||
|
||||
var index = i;
|
||||
|
||||
_container.lineEdits[0].TextChanged += (s) =>
|
||||
{
|
||||
var current = _selectedTemplate.Formats[index];
|
||||
current.format = s;
|
||||
_selectedTemplate.Formats[index] = current;
|
||||
_selectedTemplate.UpdateTime= DateTime.Now;
|
||||
};
|
||||
_container.lineEdits[1].TextChanged += s =>
|
||||
{
|
||||
var current = _selectedTemplate.Formats[index];
|
||||
current.hint = s;
|
||||
_selectedTemplate.Formats[index] = current;
|
||||
};
|
||||
_container.lineEdits[2].TextChanged += s =>
|
||||
{
|
||||
var current = _selectedTemplate.Formats[index];
|
||||
current.category = s;
|
||||
_selectedTemplate.Formats[index] = current;
|
||||
};
|
||||
_container.button.Pressed += () =>
|
||||
{
|
||||
_selectedTemplate.Formats.RemoveAt(index);
|
||||
EnsureConfigure();
|
||||
};
|
||||
|
||||
container.AddChild(_container);
|
||||
}
|
||||
}
|
||||
private void OnItemSelected(long id)
|
||||
{
|
||||
|
||||
}
|
||||
private void OnItemClicked(long index, Vector2 atPosition, long mouseButtonIndex)
|
||||
{
|
||||
// var currentItem = _templates[(int)index];
|
||||
// templateNameEdit.Text = currentItem.TemplateName;
|
||||
_selectedIndex = (int)index;
|
||||
EnsureConfigure();
|
||||
var current = _selectedTemplate.Formats[index];
|
||||
current.format = s;
|
||||
_selectedTemplate.Formats[index] = current;
|
||||
_selectedTemplate.UpdateTime = DateTime.Now;
|
||||
};
|
||||
_container.lineEdits[1].TextChanged += s =>
|
||||
{
|
||||
var current = _selectedTemplate.Formats[index];
|
||||
current.hint = s;
|
||||
_selectedTemplate.Formats[index] = current;
|
||||
};
|
||||
_container.lineEdits[2].TextChanged += s =>
|
||||
{
|
||||
var current = _selectedTemplate.Formats[index];
|
||||
current.category = s;
|
||||
_selectedTemplate.Formats[index] = current;
|
||||
};
|
||||
_container.button.Pressed += () =>
|
||||
{
|
||||
_selectedTemplate.Formats.RemoveAt(index);
|
||||
EnsureConfigure();
|
||||
};
|
||||
|
||||
container.AddChild(_container);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BITKit;
|
||||
|
||||
namespace BITFactory;
|
||||
|
@ -7,18 +9,26 @@ public partial class IDIS_UpdateService : Node
|
|||
{
|
||||
[ExportCategory("Service")]
|
||||
[Export] private IDIS_Service service;
|
||||
|
||||
[Export] private IDIS_TemplateService templateService;
|
||||
|
||||
[ExportCategory("UI 绑定")]
|
||||
[Export] private NodeBuilder indexBuilder;
|
||||
[Export] private NodeBuilder templateBuilder;
|
||||
[Export] private LineEdit handleEdit;
|
||||
[Export] private Button submitButton;
|
||||
[Export] private RichTextLabel hintsLabel;
|
||||
|
||||
private ButtonGroup _buttonGroup;
|
||||
|
||||
private readonly Dictionary<string,LineEdit> dataEdits = new();
|
||||
public override void _Ready()
|
||||
{
|
||||
_buttonGroup = new ButtonGroup();
|
||||
|
||||
submitButton.Pressed += Submit;
|
||||
|
||||
submitButton.Disabled = true;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
@ -38,11 +48,36 @@ public partial class IDIS_UpdateService : Node
|
|||
private void Entry(IDIS_Template template)
|
||||
{
|
||||
templateBuilder.Clear();
|
||||
dataEdits.Clear();
|
||||
foreach (var x in template.Formats)
|
||||
{
|
||||
var container = templateBuilder.Build<UXContainer>();
|
||||
container.Text = x.format;
|
||||
container.lineEdit.PlaceholderText = x.hint;
|
||||
|
||||
dataEdits.TryAdd(x.format, container.lineEdit);
|
||||
}
|
||||
|
||||
submitButton.Disabled = false;
|
||||
}
|
||||
|
||||
private void Submit()
|
||||
{
|
||||
if (string.IsNullOrEmpty(handleEdit.Text))
|
||||
{
|
||||
hintsLabel.Text="请填写标识码";
|
||||
return;
|
||||
}
|
||||
var handle = handleEdit.Text;
|
||||
var values = new Dictionary<string, string>(
|
||||
dataEdits
|
||||
.Where(x=>string.IsNullOrEmpty(x.Value.Text) is false)
|
||||
.Select(x => new KeyValuePair<string, string>(x.Key, x.Value.Text))
|
||||
);
|
||||
foreach (var x in values)
|
||||
{
|
||||
service.Update(handle, x.Key, x.Value);
|
||||
}
|
||||
hintsLabel.Text=$"更新成功,已更新{values.Count}个值"+DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Net.Mime;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Timers;
|
||||
|
@ -13,7 +15,7 @@ namespace BITFactory;
|
|||
public partial class 温湿度Reader : Node
|
||||
{
|
||||
[ExportCategory("参数")]
|
||||
[Export(PropertyHint.Range,"100,1000")] private int interval=500;
|
||||
[Export(PropertyHint.Range,"100,2000")] private int interval=500;
|
||||
|
||||
[ExportCategory("网络设置")]
|
||||
[Export] private string ip="192.168.3.7";
|
||||
|
@ -33,6 +35,7 @@ public partial class 温湿度Reader : Node
|
|||
private ModbusMaster _modbus;
|
||||
private System.Timers.Timer timer;
|
||||
private CancellationTokenSource _CancellationTokenSource;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_CancellationTokenSource = new CancellationTokenSource();
|
||||
|
@ -67,11 +70,13 @@ public partial class 温湿度Reader : Node
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpdatePortAndIP();
|
||||
|
||||
timer = new Timer();
|
||||
timer.Interval = interval;
|
||||
timer.Elapsed += OnTimerElapsed;
|
||||
timer.AutoReset = true;
|
||||
timer.AutoReset = false;
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
|
@ -79,29 +84,42 @@ public partial class 温湿度Reader : Node
|
|||
{
|
||||
timer.Stop();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 内部方法,用于更新IP和端口
|
||||
/// </summary>
|
||||
private void UpdatePortAndIP()
|
||||
{
|
||||
_modbus.Dispose();
|
||||
_modbus = ModbusMaster.TCP(ip, port);
|
||||
_modbus?.Dispose();
|
||||
try
|
||||
{
|
||||
_modbus = ModbusMaster.TCP(ip, port);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
BIT4Log.Log<温湿度Reader>(e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 内部方法,定时器回调用于读取Modbus
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private async void OnTimerElapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
SetHints( "正在获取温湿度数据..."+DateTime.Now);
|
||||
_CancellationTokenSource.Cancel();
|
||||
await UniTask.SwitchToTaskPool();
|
||||
try
|
||||
{
|
||||
_CancellationTokenSource.Token.ThrowIfCancellationRequested();
|
||||
hintsLabel.SetTextAsync( "正在读取温湿度数据..."+DateTime.Now);
|
||||
|
||||
var vs = _modbus.ReadInputRegisters(1, 0, 2);
|
||||
|
||||
_CancellationTokenSource.Token.ThrowIfCancellationRequested();
|
||||
|
||||
hintsLabel.SetTextAsync( "已采集到数据,正在解析..."+DateTime.Now);
|
||||
|
||||
if (vs is not { Length: 2 })
|
||||
{
|
||||
SetHints(hintsLabel.Text = $"获取温湿度数据失败:数据长度为:{vs.Length}"+DateTime.Now);
|
||||
hintsLabel.SetTextAsync(hintsLabel.Text = $"获取温湿度数据失败:数据长度为:{vs.Length}"+DateTime.Now);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -109,25 +127,21 @@ public partial class 温湿度Reader : Node
|
|||
temperature = vs[0] / 10.0;
|
||||
humidity = vs[1] / 10.0;
|
||||
|
||||
SetHints("已获取到温湿度数据:"+DateTime.Now);
|
||||
hintsLabel.SetTextAsync("已获取到温湿度数据:"+DateTime.Now);
|
||||
|
||||
temperatureContaier.Text = temperature.ToString(CultureInfo.InvariantCulture);
|
||||
humidityContainer.Text = humidity.ToString(CultureInfo.InvariantCulture);
|
||||
temperatureContaier.label.SetTextAsync(temperature.ToString(CultureInfo.InvariantCulture)); ;
|
||||
humidityContainer.label.SetTextAsync(humidity.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
//SetHints("连接超时:"+DateTime.Now);
|
||||
hintsLabel.SetTextAsync("连接超时:"+DateTime.Now);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SetHints(ex.Message);
|
||||
GD.Print("ex:" + ex);
|
||||
hintsLabel.SetTextAsync(ex.Message);
|
||||
//GD.Print("ex:" + ex);
|
||||
}
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
private async void SetHints(string hints)
|
||||
{
|
||||
await UniTask.SwitchToSynchronizationContext(BITApp.SynchronizationContext);
|
||||
hintsLabel.Text = hints;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -233,39 +233,61 @@ text = "标识模板"
|
|||
text = "在注册与更新标识之前,我们需要一个创建标识模板,
|
||||
然后我们可以通过创建的模板注册标识"
|
||||
|
||||
[node name="占位符" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/标题栏Template" index="2"]
|
||||
visible = false
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 64
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer"]
|
||||
[node name="VBoxContainer3" type="VBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Label" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||
[node name="Label" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer3"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderLarge"
|
||||
text = "标识注册模板"
|
||||
text = "模板列表"
|
||||
|
||||
[node name="ItemList" type="ItemList" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer3"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
auto_height = true
|
||||
item_count = 3
|
||||
item_0/text = "1"
|
||||
item_1/text = "2"
|
||||
item_2/text = "3"
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||
[node name="NodeBuilder" type="VBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer3/ScrollContainer" node_paths=PackedStringArray("emptyHints")]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 12
|
||||
script = ExtResource("14_q0cb2")
|
||||
emptyHints = NodePath("Label2")
|
||||
template = ExtResource("14_pcoc2")
|
||||
|
||||
[node name="Button" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||
[node name="Option-Button" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer3/ScrollContainer/NodeBuilder" node_paths=PackedStringArray("button") instance=ExtResource("14_pcoc2")]
|
||||
layout_mode = 2
|
||||
button = NodePath("../../../../../../../标识更新/Layout/HBoxContainer/VBoxContainer2/ScrollContainer/NodeBuilder/Option-Button/Button")
|
||||
|
||||
[node name="Option-Button2" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer3/ScrollContainer/NodeBuilder" node_paths=PackedStringArray("button") instance=ExtResource("14_pcoc2")]
|
||||
layout_mode = 2
|
||||
button = NodePath("../../../../../../../标识更新/Layout/HBoxContainer/VBoxContainer2/ScrollContainer/NodeBuilder/Option-Button2/Button")
|
||||
|
||||
[node name="Option-Button3" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer3/ScrollContainer/NodeBuilder" node_paths=PackedStringArray("button") instance=ExtResource("14_pcoc2")]
|
||||
layout_mode = 2
|
||||
button = NodePath("../../../../../../../标识更新/Layout/HBoxContainer/VBoxContainer2/ScrollContainer/NodeBuilder/Option-Button3/Button")
|
||||
|
||||
[node name="Option-Button4" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer3/ScrollContainer/NodeBuilder" node_paths=PackedStringArray("button") instance=ExtResource("14_pcoc2")]
|
||||
layout_mode = 2
|
||||
button = NodePath("../../../../../../../标识更新/Layout/HBoxContainer/VBoxContainer2/ScrollContainer/NodeBuilder/Option-Button4/Button")
|
||||
|
||||
[node name="Option-Button5" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer3/ScrollContainer/NodeBuilder" node_paths=PackedStringArray("button") instance=ExtResource("14_pcoc2")]
|
||||
layout_mode = 2
|
||||
button = NodePath("../../../../../../../标识更新/Layout/HBoxContainer/VBoxContainer2/ScrollContainer/NodeBuilder/Option-Button5/Button")
|
||||
|
||||
[node name="Label2" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer3/ScrollContainer/NodeBuilder"]
|
||||
layout_mode = 2
|
||||
text = "oops,没有找到标识模板,去创建模板吧!"
|
||||
|
||||
[node name="Button" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer3"]
|
||||
layout_mode = 2
|
||||
text = "创建新的注册模板"
|
||||
|
||||
[node name="VSeparator" type="VSeparator" parent="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 64
|
||||
|
||||
|
@ -396,7 +418,6 @@ layout_mode = 2
|
|||
text = "保存注册模板"
|
||||
|
||||
[node name="标注注册" type="MarginContainer" parent="Layout/UX Window Service/Horizontal Layout/内容"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 64
|
||||
theme_override_constants/margin_top = 64
|
||||
|
@ -417,27 +438,46 @@ text = "当我们创建标识模板后,我们就可以通过标识模板快速
|
|||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 64
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer"]
|
||||
[node name="NodeBuilder" type="VBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer" node_paths=PackedStringArray("emptyHints")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 12
|
||||
script = ExtResource("14_q0cb2")
|
||||
emptyHints = NodePath("Label2")
|
||||
template = ExtResource("14_pcoc2")
|
||||
|
||||
[node name="Label" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||
[node name="Label" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/NodeBuilder"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderLarge"
|
||||
text = "选择标识模板"
|
||||
|
||||
[node name="ItemList" type="ItemList" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||
[node name="Option-Button" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/NodeBuilder" node_paths=PackedStringArray("button") instance=ExtResource("14_pcoc2")]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
auto_height = true
|
||||
item_count = 4
|
||||
item_0/text = "1"
|
||||
item_1/text = "2"
|
||||
item_2/text = "3"
|
||||
item_3/text = "4"
|
||||
button = NodePath("../../../../../标识更新/Layout/HBoxContainer/VBoxContainer2/ScrollContainer/NodeBuilder/Option-Button/Button")
|
||||
|
||||
[node name="Option-Button2" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/NodeBuilder" node_paths=PackedStringArray("button") instance=ExtResource("14_pcoc2")]
|
||||
layout_mode = 2
|
||||
button = NodePath("../../../../../标识更新/Layout/HBoxContainer/VBoxContainer2/ScrollContainer/NodeBuilder/Option-Button2/Button")
|
||||
|
||||
[node name="Option-Button3" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/NodeBuilder" node_paths=PackedStringArray("button") instance=ExtResource("14_pcoc2")]
|
||||
layout_mode = 2
|
||||
button = NodePath("../../../../../标识更新/Layout/HBoxContainer/VBoxContainer2/ScrollContainer/NodeBuilder/Option-Button3/Button")
|
||||
|
||||
[node name="Option-Button4" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/NodeBuilder" node_paths=PackedStringArray("button") instance=ExtResource("14_pcoc2")]
|
||||
layout_mode = 2
|
||||
button = NodePath("../../../../../标识更新/Layout/HBoxContainer/VBoxContainer2/ScrollContainer/NodeBuilder/Option-Button4/Button")
|
||||
|
||||
[node name="Option-Button5" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/NodeBuilder" node_paths=PackedStringArray("button") instance=ExtResource("14_pcoc2")]
|
||||
layout_mode = 2
|
||||
button = NodePath("../../../../../标识更新/Layout/HBoxContainer/VBoxContainer2/ScrollContainer/NodeBuilder/Option-Button5/Button")
|
||||
|
||||
[node name="Label2" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/NodeBuilder"]
|
||||
layout_mode = 2
|
||||
text = "oops,没有找到标识模板,去创建模板吧!"
|
||||
|
||||
[node name="VSeparator" type="VSeparator" parent="Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 64
|
||||
|
||||
|
@ -514,6 +554,7 @@ theme_override_styles/background = SubResource("StyleBoxEmpty_1rin1")
|
|||
show_percentage = false
|
||||
|
||||
[node name="标识更新" type="MarginContainer" parent="Layout/UX Window Service/Horizontal Layout/内容"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 64
|
||||
theme_override_constants/margin_top = 64
|
||||
|
@ -522,6 +563,7 @@ theme_override_constants/margin_bottom = 128
|
|||
|
||||
[node name="Layout" type="VBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/标识更新"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="标题栏Template" parent="Layout/UX Window Service/Horizontal Layout/内容/标识更新/Layout" instance=ExtResource("13_7vm0l")]
|
||||
layout_mode = 2
|
||||
|
@ -536,6 +578,7 @@ layout_mode = 2
|
|||
|
||||
[node name="Label" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/标识更新/Layout/HBoxContainer/VBoxContainer2"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderLarge"
|
||||
text = "模板列表"
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/标识更新/Layout/HBoxContainer/VBoxContainer2"]
|
||||
|
@ -624,6 +667,17 @@ text = "选择一个模板,然后我们开始更新"
|
|||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/标识更新/Layout"]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="hints" type="RichTextLabel" parent="Layout/UX Window Service/Horizontal Layout/内容/标识更新/Layout/HBoxContainer3"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "等待更新中"
|
||||
fit_content = true
|
||||
text_direction = 2
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/标识更新/Layout"]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
@ -900,12 +954,26 @@ layout_mode = 2
|
|||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderLarge"
|
||||
theme_override_colors/font_color = Color(0.509804, 0.509804, 0.509804, 1)
|
||||
text = "已获取的传感器数据"
|
||||
text = "配置传感器参数"
|
||||
|
||||
[node name="GridContainer2" type="GridContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
columns = 3
|
||||
|
||||
[node name="Label-0" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer/GridContainer2"]
|
||||
layout_mode = 2
|
||||
text = "标识码:"
|
||||
|
||||
[node name="LineEdit-0" type="LineEdit" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer/GridContainer2"]
|
||||
custom_minimum_size = Vector2(384, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "88.123.99/xxxxxxxxxxxxxxxx"
|
||||
|
||||
[node name="hints-2" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer/GridContainer2"]
|
||||
layout_mode = 2
|
||||
text = "88.123.99开头"
|
||||
|
||||
[node name="Label" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer/GridContainer2"]
|
||||
layout_mode = 2
|
||||
text = "IP:"
|
||||
|
@ -956,13 +1024,26 @@ text = "湿度"
|
|||
[node name="Label2" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer/GridContainer/传感器数据模板2/VBoxContainer/MarginContainer/HBoxContainer" index="1"]
|
||||
text = "%"
|
||||
|
||||
[node name="自动更新提示-label" type="RichTextLabel" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "正在等待自动更新"
|
||||
fit_content = true
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "正在等待连接到温湿度传感器..."
|
||||
fit_content = true
|
||||
|
||||
[node name="更新温湿度-button" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer"]
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="自动更新-button" type="CheckButton" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "自动更新"
|
||||
|
||||
[node name="更新温湿度-button" type="Button" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "更新温湿度"
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer"]
|
||||
|
@ -978,20 +1059,6 @@ text = "手动提交数据"
|
|||
layout_mode = 2
|
||||
columns = 3
|
||||
|
||||
[node name="Label-0" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer2/GridContainer2"]
|
||||
layout_mode = 2
|
||||
text = "标识码:"
|
||||
|
||||
[node name="LineEdit-0" type="LineEdit" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer2/GridContainer2"]
|
||||
custom_minimum_size = Vector2(384, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "88.123.99/xxxxxxxxxxxxxxxx"
|
||||
|
||||
[node name="hints-0" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer2/GridContainer2"]
|
||||
layout_mode = 2
|
||||
text = "88.123.99开头"
|
||||
|
||||
[node name="Label2" type="Label" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer2/GridContainer2"]
|
||||
layout_mode = 2
|
||||
text = "温度:"
|
||||
|
@ -1006,6 +1073,7 @@ textValidation = SubResource("Resource_di31i")
|
|||
hints = NodePath("../hints-1")
|
||||
|
||||
[node name="hints-1" type="RichTextLabel" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer2/GridContainer2"]
|
||||
custom_minimum_size = Vector2(128, 0)
|
||||
layout_mode = 2
|
||||
bbcode_enabled = true
|
||||
text = "输入正确的温度"
|
||||
|
@ -1025,6 +1093,7 @@ textValidation = SubResource("Resource_di31i")
|
|||
hints = NodePath("../hints-2")
|
||||
|
||||
[node name="hints-2" type="RichTextLabel" parent="Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer2/GridContainer2"]
|
||||
custom_minimum_size = Vector2(128, 0)
|
||||
layout_mode = 2
|
||||
bbcode_enabled = true
|
||||
|
||||
|
@ -1043,11 +1112,11 @@ layout_mode = 2
|
|||
[node name="标识解析服务" type="Node" parent="."]
|
||||
script = ExtResource("3_xbtmk")
|
||||
|
||||
[node name="标识模板服务" type="Node" parent="." node_paths=PackedStringArray("createButton", "newFormatButton", "itemList", "templateNameEdit", "templateDescriptionEdit", "container", "templateCreateTimeLabel", "templateUpdateTimeLabel")]
|
||||
[node name="标识模板服务" type="Node" parent="." node_paths=PackedStringArray("createButton", "newFormatButton", "templateIndexBuilder", "templateNameEdit", "templateDescriptionEdit", "container", "templateCreateTimeLabel", "templateUpdateTimeLabel")]
|
||||
script = ExtResource("4_oj8cs")
|
||||
createButton = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer/Button")
|
||||
createButton = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer3/Button")
|
||||
newFormatButton = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer2/VBoxContainer/Button")
|
||||
itemList = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer/ItemList")
|
||||
templateIndexBuilder = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer3/ScrollContainer/NodeBuilder")
|
||||
templateNameEdit = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer2/VBoxContainer/name-edit")
|
||||
templateDescriptionEdit = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer2/VBoxContainer/description-edit")
|
||||
container = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer2/VBoxContainer/ScrollContainer/Format-Container")
|
||||
|
@ -1055,11 +1124,11 @@ templateCreateTimeLabel = NodePath("../Layout/UX Window Service/Horizontal Layou
|
|||
templateUpdateTimeLabel = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/HBoxContainer/VBoxContainer2/VBoxContainer/GridContainer/updateTime-label")
|
||||
templateContainer = ExtResource("3_gmthc")
|
||||
|
||||
[node name="标识注册服务" type="Node" parent="." node_paths=PackedStringArray("service", "templateService", "templateList", "handleEdit", "generateHandleButton", "registerContainer", "registerButton", "registerProgress", "referenceContainer", "addReferenceButton", "hints")]
|
||||
[node name="标识注册服务" type="Node" parent="." node_paths=PackedStringArray("service", "templateService", "templateIndexBuilder", "handleEdit", "generateHandleButton", "registerContainer", "registerButton", "registerProgress", "referenceContainer", "addReferenceButton", "hints")]
|
||||
script = ExtResource("8_6uwr0")
|
||||
service = NodePath("../标识解析服务")
|
||||
templateService = NodePath("../标识模板服务")
|
||||
templateList = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/VBoxContainer/ItemList")
|
||||
templateIndexBuilder = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/NodeBuilder")
|
||||
handleEdit = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/VBoxContainer2/HBoxContainer/handle-edit")
|
||||
generateHandleButton = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/VBoxContainer2/HBoxContainer/generate-button")
|
||||
registerContainer = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标注注册/VBoxContainer/HBoxContainer/VBoxContainer2/MarginContainer/VBoxContainer/register-container")
|
||||
|
@ -1085,15 +1154,17 @@ valueTemplate = ExtResource("19_abuse")
|
|||
referenceTemplate = ExtResource("14_0l0dn")
|
||||
categoryTemplate = ExtResource("20_kicyn")
|
||||
|
||||
[node name="温湿度标识更新服务" type="Node" parent="." node_paths=PackedStringArray("service", "thReader", "submitButton", "handleEdit", "temperatureEdit", "humidityEdit", "hintsLabel")]
|
||||
[node name="温湿度标识更新服务" type="Node" parent="." node_paths=PackedStringArray("service", "thReader", "submitButton", "autoUpdateButton", "handleEdit", "temperatureEdit", "humidityEdit", "hintsLabel", "autoUpdateLabel")]
|
||||
script = ExtResource("30_jn688")
|
||||
service = NodePath("../标识解析服务")
|
||||
thReader = NodePath("../温湿度传感器Reader")
|
||||
submitButton = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer2/更新温湿度-button2")
|
||||
handleEdit = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer2/GridContainer2/LineEdit-0")
|
||||
autoUpdateButton = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer/HBoxContainer/自动更新-button")
|
||||
handleEdit = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer/GridContainer2/LineEdit-0")
|
||||
temperatureEdit = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer2/GridContainer2/LineEdit2")
|
||||
humidityEdit = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer2/GridContainer2/LineEdit3")
|
||||
hintsLabel = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer2/Label3")
|
||||
autoUpdateLabel = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer/自动更新提示-label")
|
||||
|
||||
[node name="温湿度传感器Reader" type="Node" parent="." node_paths=PackedStringArray("temperatureContaier", "humidityContainer", "ipEdit", "portEdit", "hintsLabel")]
|
||||
script = ExtResource("27_q8j7q")
|
||||
|
@ -1103,16 +1174,17 @@ ipEdit = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/温湿
|
|||
portEdit = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer/GridContainer2/LineEdit2")
|
||||
hintsLabel = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/温湿度传感器/VBoxContainer/VBoxContainer/RichTextLabel")
|
||||
|
||||
[node name="标识更新服务" type="Node" parent="." node_paths=PackedStringArray("service", "templateService", "indexBuilder", "templateBuilder", "handleEdit")]
|
||||
[node name="标识更新服务" type="Node" parent="." node_paths=PackedStringArray("service", "templateService", "indexBuilder", "templateBuilder", "handleEdit", "submitButton", "hintsLabel")]
|
||||
script = ExtResource("26_a6qku")
|
||||
service = NodePath("../标识解析服务")
|
||||
templateService = NodePath("../标识模板服务")
|
||||
indexBuilder = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识更新/Layout/HBoxContainer/VBoxContainer2/ScrollContainer/NodeBuilder")
|
||||
templateBuilder = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识更新/Layout/HBoxContainer/VBoxContainer/NodeBuilder")
|
||||
handleEdit = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识更新/Layout/HBoxContainer/VBoxContainer/LineEditTemplate/MarginContainer/Layout/LineEdit")
|
||||
submitButton = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识更新/Layout/HBoxContainer2/Button")
|
||||
hintsLabel = NodePath("../Layout/UX Window Service/Horizontal Layout/内容/标识更新/Layout/HBoxContainer3/hints")
|
||||
|
||||
[connection signal="pressed" from="Layout/UX Window Service/Horizontal Layout/导航栏/MarginContainer/Layout/Button5" to="Layout/UX Window Service/Horizontal Layout/导航栏/MarginContainer/Layout/Button5" method="Return"]
|
||||
[connection signal="draw" from="Layout/UX Window Service/Horizontal Layout/内容/标注注册" to="标识注册服务" method="Rebuild"]
|
||||
[connection signal="pressed" from="Layout/UX Window Service/Horizontal Layout/内容/标识解析/Search/SearchEdit/HBoxContainer/refresh-button" to="标识搜索服务" method="Search"]
|
||||
|
||||
[editable path="Layout/UX Window Service/Horizontal Layout/内容/标识模板/VBoxContainer/标题栏Template"]
|
||||
|
|
|
@ -112,43 +112,43 @@ theme_override_constants/margin_bottom = 32
|
|||
layout_mode = 2
|
||||
theme_override_constants/separation = 32
|
||||
|
||||
[node name="HBoxContainer" type="VBoxContainer" parent="UXPanel/ReferenceRect/HBoxContainer"]
|
||||
[node name="Layout" type="VBoxContainer" parent="UXPanel/ReferenceRect/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(384, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="UXPanel/ReferenceRect/HBoxContainer/HBoxContainer"]
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="UXPanel/ReferenceRect/HBoxContainer/Layout"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/HBoxContainer/HBoxContainer"]
|
||||
[node name="Label" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/Layout/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderLarge"
|
||||
text = "CAICT定制版"
|
||||
|
||||
[node name="Label2" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/HBoxContainer/HBoxContainer"]
|
||||
[node name="Label2" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/Layout/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
text = "仅包括1个课程"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="UXPanel/ReferenceRect/HBoxContainer/HBoxContainer"]
|
||||
[node name="HSeparator" type="HSeparator" parent="UXPanel/ReferenceRect/HBoxContainer/Layout"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 32
|
||||
|
||||
[node name="Label3" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/HBoxContainer"]
|
||||
[node name="Label3" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/Layout"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderLarge"
|
||||
text = "教程与实训"
|
||||
|
||||
[node name="Label4" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/HBoxContainer"]
|
||||
[node name="Label4" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/Layout"]
|
||||
layout_mode = 2
|
||||
theme_type_variation = &"HeaderSmall"
|
||||
theme_override_colors/font_color = Color(0, 0.698039, 0.886275, 1)
|
||||
text = "导入链接(试用版未启用)"
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="UXPanel/ReferenceRect/HBoxContainer/HBoxContainer"]
|
||||
[node name="HSeparator2" type="HSeparator" parent="UXPanel/ReferenceRect/HBoxContainer/Layout"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 32
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="UXPanel/ReferenceRect/HBoxContainer/HBoxContainer"]
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="UXPanel/ReferenceRect/HBoxContainer/Layout"]
|
||||
layout_mode = 2
|
||||
bbcode_enabled = true
|
||||
text = "最后更新时间:
|
||||
|
@ -161,6 +161,28 @@ Powered By
|
|||
重庆市渝北区宝圣湖街道食品城大道18号重庆广告产业园15幢1单元2-3"
|
||||
fit_content = true
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="UXPanel/ReferenceRect/HBoxContainer/Layout"]
|
||||
layout_mode = 2
|
||||
columns = 2
|
||||
|
||||
[node name="Label" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/Layout/GridContainer"]
|
||||
layout_mode = 2
|
||||
text = "联系人:"
|
||||
|
||||
[node name="Label2" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/Layout/GridContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "王浩 15928031321"
|
||||
|
||||
[node name="Label3" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/Layout/GridContainer"]
|
||||
layout_mode = 2
|
||||
text = "邮箱:"
|
||||
|
||||
[node name="Label4" type="Label" parent="UXPanel/ReferenceRect/HBoxContainer/Layout/GridContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "wanghao@cn-intelli.com"
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="UXPanel/ReferenceRect/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
@ -187,11 +209,14 @@ text = "工业互联网标识解析"
|
|||
text = "#371647"
|
||||
|
||||
[node name="Label2" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect4/MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer/VBoxContainer2" index="1"]
|
||||
text = "2"
|
||||
text = "5"
|
||||
|
||||
[node name="Label2" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect4/MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer/VBoxContainer3" index="1"]
|
||||
text = "0"
|
||||
|
||||
[node name="Label2" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect4/MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer/VBoxContainer4" index="1"]
|
||||
text = "1"
|
||||
|
||||
[node name="Label2" parent="UXPanel/ReferenceRect/HBoxContainer/ScrollContainer/VBoxContainer/NinePatchRect4/MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer/VBoxContainer6" index="1"]
|
||||
text = "30"
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="6.0.19" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0-preview.4.23259.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0-preview.4.23259.5" />
|
||||
<PackageReference Include="MySql.EntityFrameworkCore" Version="6.0.13" />
|
||||
<PackageReference Include="SharpModbus" Version="2.0.0" />
|
||||
<PackageReference Include="UniTask" Version="2.3.3" />
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue