创建与注册更新

现在可以注册模板并注册标识了
This commit is contained in:
CortexCore
2023-07-08 15:32:06 +08:00
parent 6fc4279878
commit 36a4309730
8 changed files with 205 additions and 76 deletions

View File

@@ -1,6 +1,7 @@
using Godot;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using BITKit;
@@ -14,6 +15,8 @@ public class IDIS_Template
public string TemplateName="标识注册模板";
public string TemplateDescription="该模板通常用于xxx用途";
public string IconPath="Register";
public DateTime CreateTime=DateTime.Now;
public DateTime UpdateTime=DateTime.Now;
public List<(string format,string hint)> Formats=new();
}
public partial class IDIS_TemplateService : Node
@@ -29,6 +32,8 @@ public partial class IDIS_TemplateService : Node
[Export] private LineEdit templateNameEdit;
[Export] private LineEdit templateDescriptionEdit;
[Export] private Control container;
[Export] private Label templateCreateTimeLabel;
[Export] private Label templateUpdateTimeLabel;
[ExportCategory("Template")]
[Export] private PackedScene templateContainer;
@@ -67,6 +72,7 @@ public partial class IDIS_TemplateService : Node
if (_selectedTemplate is null) return;
_selectedTemplate.Formats ??= new();
_selectedTemplate.Formats.Add(("新的数据格式","格式类型"));
_selectedTemplate.UpdateTime= DateTime.Now;
EnsureConfigure();
}
@@ -91,11 +97,13 @@ public partial class IDIS_TemplateService : Node
{
if (_selectedTemplate is null) return;
_selectedTemplate.TemplateName = text;
_selectedTemplate.UpdateTime= DateTime.Now;
}
private void OnTemplateDescriptionChanged(string text)
{
if (_selectedTemplate is null) return;
_selectedTemplate.TemplateDescription = text;
_selectedTemplate.UpdateTime= DateTime.Now;
}
private void EnsureConfigure()
{
@@ -108,9 +116,10 @@ public partial class IDIS_TemplateService : Node
}
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++)
{
@@ -127,6 +136,7 @@ public partial class IDIS_TemplateService : Node
var current = _selectedTemplate.Formats[index];
current.format = s;
_selectedTemplate.Formats[index] = current;
_selectedTemplate.UpdateTime= DateTime.Now;
};
_container.lineEdits[1].TextChanged += s =>
{
@@ -142,7 +152,6 @@ public partial class IDIS_TemplateService : Node
container.AddChild(_container);
}
}
}
private void OnItemSelected(long id)
{