添加到从Excel导入的对话框

This commit is contained in:
2025-07-04 13:41:50 +08:00
parent 02eab6ecf0
commit 7995b46586
5 changed files with 483 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using PMSWPF.Helper;
using PMSWPF.Models;
namespace PMSWPF.ViewModels.Dialogs;
public partial class ImportExcelDialogViewModel : ObservableObject
{
[ObservableProperty]
private string? _filePath;
[ObservableProperty]
private ObservableCollection<VariableData> _variableData = new();
partial void OnFilePathChanged(string? value)
{
if (string.IsNullOrEmpty(value))
{
return;
}
try
{
var data = ExcelHelper.ImprotFromTiaVariableTable(value);
VariableData = new ObservableCollection<VariableData>(data);
}
catch (System.Exception ex)
{
// Handle exception
}
}
}