You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.Toolkit.Mvvm.ComponentModel;
- using Microsoft.Toolkit.Mvvm.Input;
- using BPASmartClient.SmallBatchingSystem.Views;
- using System.Collections.ObjectModel;
- using BPA.Helper;
-
- namespace BPASmartClient.SmallBatchingSystem.ViewModels
- {
- public class SiloManagementViewModel : BaseModel
- {
- public SiloManagementViewModel()
- {
- AddCommand = new RelayCommand(() =>
- {
- NewSiloView newSiloView = new NewSiloView();
- newSiloView.ShowDialog();
- });
- SaveCommand = new RelayCommand(() => { Json<ConfigInfoModel>.Save(); });
- SiloInfoModels = Json<ConfigInfoModel>.Data.SiloInfoModels;
- RemoveCommand = new RelayCommand<object>((o) =>
- {
- if (!string.IsNullOrEmpty(o?.ToString()))
- {
- var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == o.ToString());
- if (res != null)
- {
- Json<ConfigInfoModel>.Data.SiloInfoModels.Remove(res);
- Control.GetInstance.NotifyPrompt($"{res.SiloName} 删除成功");
- Control.GetInstance.OperationLog($"{res.SiloName} 删除成功");
- }
- }
- });
-
- DetailsCommand = new RelayCommand<object>((o) =>
- {
- if (!string.IsNullOrEmpty(o?.ToString()))
- {
- var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == o.ToString());
- if (res != null)
- {
- NewSiloView newSiloView = new NewSiloView();
- ActionManage.GetInstance.Send("OpenNewSilo", res);
- newSiloView.ShowDialog();
- Control.GetInstance.OperationLog($"{res.SiloName} 编辑完成");
- }
- }
- });
- }
-
- public ObservableCollection<SiloInfoModel> SiloInfoModels { get; set; }
-
- }
- }
|