|
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using BPA.Helper;
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.SmallBatchingSystem.Views;
- using Microsoft.Toolkit.Mvvm.ComponentModel;
- using Microsoft.Toolkit.Mvvm.Input;
-
- namespace BPASmartClient.SmallBatchingSystem.ViewModels
- {
- public class OutletManagementViewModel : BaseModel
- {
- public OutletManagementViewModel()
- {
- AddCommand = new RelayCommand(() =>
- {
- NewOutletView newOutletView = new NewOutletView();
- newOutletView.ShowDialog();
- });
- SaveCommand = new RelayCommand(() => { Json<ConfigInfoModel>.Save(); });
- OutletInfoModels = Json<ConfigInfoModel>.Data.OutletInfoModels;
- RemoveCommand = new RelayCommand<object>((o) =>
- {
- if (!string.IsNullOrEmpty(o?.ToString()))
- {
- var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
- if (res != null)
- {
- if (MessageNotify.GetInstance.ShowDialog($"是否删除【{res.OutletName}】出料口,删除后数据将永久丢失!无法找回", DialogType.Warning))
- {
- Json<ConfigInfoModel>.Data.OutletInfoModels.Remove(res);
- Control.GetInstance.OperationLog($"{res.OutletName} 删除成功");
- }
- }
- }
- });
-
- DetailsCommand = new RelayCommand<object>((o) =>
- {
- if (!string.IsNullOrEmpty(o?.ToString()))
- {
- var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
- if (res != null)
- {
- NewOutletView newOutletView = new NewOutletView();
- ActionManage.GetInstance.Send("OpenNewOutlet", res);
- newOutletView.ShowDialog();
- }
- }
- });
- }
-
- public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; }
-
-
- }
- }
|