using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using Microsoft.Extensions.DependencyInjection; using SlnMesnac.Repository; using SlnMesnac.Repository.service; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; #region << 版 本 注 释 >> /*-------------------------------------------------------------------- * 版权所有 (c) 2024 WenJY 保留所有权利。 * CLR版本:4.0.30319.42000 * 机器名称:T14-GEN3-7895 * 命名空间:SlnMesnac.WPF.ViewModel * 唯一标识:b5cb5a41-5885-475f-b182-9ea83f983978 * * 创建者:WenJY * 电子邮箱: * 创建时间:2024-11-08 15:57:46 * 版本:V1.0.0 * 描述: * *-------------------------------------------------------------------- * 修改人: * 时间: * 修改说明: * * 版本:V1.0.0 *--------------------------------------------------------------------*/ #endregion << 版 本 注 释 >> namespace SlnMesnac.WPF.ViewModel { public partial class CabinetUpdateViewModel : ObservableObject { private readonly Ibase_cabinet_infoServices _ibase_cabinet_infoServices; public Action CloseAction { get; set; } public CabinetUpdateViewModel(base_cabinet_info cabinet_Info) { CabinetInfo = cabinet_Info; _ibase_cabinet_infoServices = App.ServiceProvider.GetService(); } public base_cabinet_info _cabinetInfo = null; public base_cabinet_info CabinetInfo { get => _cabinetInfo; set => SetProperty(ref _cabinetInfo, value); } [RelayCommand] private void SaveCabinetInfo() { if (_cabinetInfo != null) { if (_ibase_cabinet_infoServices.Update(_cabinetInfo)) { MessageBox.Show($"电柜信息保存成功"); CloseAction?.Invoke(); } else { MessageBox.Show($"电柜信息保存失败"); } } } } }