Files
DMS/DMS.WPF/ViewModels/Dialogs/ImportExcelDialogViewModel.cs
2025-07-19 11:11:01 +08:00

34 lines
800 B
C#

using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using DMS.Helper;
using DMS.WPF.Models;
using DMS.WPF.Models;
namespace DMS.WPF.ViewModels.Dialogs;
public partial class ImportExcelDialogViewModel : ObservableObject
{
[ObservableProperty]
private string? _filePath;
[ObservableProperty]
private ObservableCollection<Variable> _variables = new();
partial void OnFilePathChanged(string? value)
{
if (string.IsNullOrEmpty(value))
{
return;
}
try
{
var data = ExcelHelper.ImprotFromTiaVariableTable(value);
Variables = new ObservableCollection<Variable>(data);
}
catch (System.Exception ex)
{
// Handle exception
}
}
}