using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using BPA.Helper; using System.Windows; using System.IO; using BPASmartClient.Model; namespace BPASmartClient.ViewModel { public class NewShopWindowModel : NotifyBase { public NewShopWindowModel() { CancelCommand = new BPARelayCommand(() => { ActionManage.GetInstance.Send("CloseWindow"); }); DefineCommand = new BPARelayCommand(() => { DirectoryInfo directoryInfo = new DirectoryInfo(LocaPath.GetDeviceConfigPath); var files = directoryInfo.GetFiles(); if (files != null && files.FirstOrDefault(p => p.FullName.Contains(ShopName)) != null) { ErrorInfo = "已存在该店铺,请重新输入!"; return; } ActionManage.GetInstance.Send("ShopPar", new string[] { ShopName, ShopId }); ActionManage.GetInstance.Send("OkCloseWindow"); }); } //public BPARelayCommand CloseWindowCommand { get; set; } public BPARelayCommand CancelCommand { get; set; } public BPARelayCommand DefineCommand { get; set; } public string ShopName { get { return _mShopName; } set { _mShopName = value; OnPropertyChanged(); } } private string _mShopName; public string ShopId { get { return _mShopId; } set { _mShopId = value; OnPropertyChanged(); } } private string _mShopId; public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } } private string _mErrorInfo; } }