You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using AI.Interface;
|
|
using AI.Models.Form;
|
|
|
|
namespace AI.Service
|
|
{
|
|
/// <summary>
|
|
/// 默认表单注册表,内置「加载散点文件」等表单定义。
|
|
/// </summary>
|
|
public class FormRegistry : IFormRegistry
|
|
{
|
|
private readonly Dictionary<string, FormDefinition> _forms = new(StringComparer.OrdinalIgnoreCase);
|
|
|
|
public FormRegistry()
|
|
{
|
|
RegisterLoadXyzForm();
|
|
}
|
|
|
|
private void RegisterLoadXyzForm()
|
|
{
|
|
_forms["gridding-load-xyz"] = new FormDefinition
|
|
{
|
|
Id = "gridding-load-xyz",
|
|
Title = "加载散点文件",
|
|
SubmitTarget = "GriddingModuleLoadXyz",
|
|
SubmitLabel = "加载",
|
|
Fields = new List<FormField>
|
|
{
|
|
new FormField
|
|
{
|
|
Id = "path",
|
|
Label = "文件路径",
|
|
Type = FormFieldType.FilePath,
|
|
Required = true,
|
|
},
|
|
},
|
|
};
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public FormDefinition? GetForm(string formId)
|
|
{
|
|
return _forms.TryGetValue(formId ?? string.Empty, out var def) ? def : null;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<FormDefinition> GetAll()
|
|
{
|
|
return _forms.Values;
|
|
}
|
|
}
|
|
}
|