40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
//using GalaSoft.MvvmLight.Command;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Unity;
|
|
using Cowain.Bake.Model;
|
|
using System.Collections.ObjectModel;
|
|
using Cowain.Bake.BLL;
|
|
using Prism.Commands;
|
|
|
|
namespace Cowain.Bake.UI.ProductManagement.ViewModels
|
|
{
|
|
public class DisableStoveViewModel
|
|
{
|
|
private IUnityContainer _unityContainer;
|
|
//public RelayCommand SaveCommand { get; set; }
|
|
public DisableStoveViewModel(IUnityContainer unityContainer)
|
|
{
|
|
_unityContainer = unityContainer;
|
|
DisplayInfo();
|
|
}
|
|
public ObservableCollection<TStation> MachineList { get; set; } = new ObservableCollection<TStation>();
|
|
public DelegateCommand<object> SaveCommand => new DelegateCommand<object>((x) =>
|
|
{
|
|
foreach (var item in MachineList)
|
|
{
|
|
_unityContainer.Resolve<StationService>().UpdateEnableStatus(item);
|
|
}
|
|
Common.Core.CommonCoreHelper.Instance.MainViewAutoEvent.Set();
|
|
HandyControl.Controls.Growl.Success("保存成功!");
|
|
});
|
|
private void DisplayInfo()
|
|
{
|
|
_unityContainer.Resolve<StationService>().GetAll().ForEach(item => MachineList.Add(item));
|
|
}
|
|
}
|
|
}
|