public void CreateStorePort() { if (StorePorts.Any(x => x.Store.UniformNumber == SelectedStore.UniformNumber)) { System.Windows.MessageBox.Show("該店舖已設定連接埠對應,請先刪除該資料。"); } else if (StorePorts.Any(x => x.Port == SelectedSerialPort)) { System.Windows.MessageBox.Show("該連接埠已被使用,請重新確認。"); } else { StorePort sp = new StorePort { Store = SelectedStore, Port = SelectedSerialPort }; GlobalConfig.Connection.CreateStorePorts(sp); StorePorts.Add(sp); NotifyOfPropertyChange(() => CanDeleteStore); } }
public void DeleteStorePort() { StorePorts.Remove(SelectedStorePort); GlobalConfig.Connection.SaveStorePorts(StorePorts.ToList()); NotifyOfPropertyChange(() => CanDeleteStore); }