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.DosingSystemSingle.View; namespace BPASmartClient.DosingSystemSingle.ViewModel { public class OutletManagementViewModel : ViewModelBase { public OutletManagementViewModel() { AddCommand = new BPARelayCommand(() => { NewOutletView newOutletView = new NewOutletView(); newOutletView.ShowDialog(); }); SaveCommand = new BPARelayCommand(() => { Json.Save(); }); OutletInfoModels = Json.Data.OutletInfoModels; RemoveCommand = new BPARelayCommand((o) => { if (!string.IsNullOrEmpty(o?.ToString())) { var res = Json.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString()); if (res != null) { Json.Data.OutletInfoModels.Remove(res); //Control.GetInstance.OperationLog($"{res.OutletName} 删除成功"); } } }); DetailsCommand = new BPARelayCommand((o) => { if (!string.IsNullOrEmpty(o?.ToString())) { var res = Json.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString()); if (res != null) { NewOutletView newOutletView = new NewOutletView(); ActionManage.GetInstance.Send("OpenNewOutlet", res); newOutletView.ShowDialog(); } } }); } public ObservableCollection OutletInfoModels { get; set; } } }