private void PropertyModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { bool dupe = false; PropertyModel newProperty = sender as PropertyModel; List <string> keysFound = new List <string>(); foreach (var property in _properties) { if (keysFound.Contains(property.Id)) { dupe = true; break; } else { keysFound.Add(property.Id); } } if (dupe) { MessageBox.Show("Dupe"); Load(); } else { if (_iswixProperties.Any(s => s.Id == newProperty.Id)) { IsWiXProperty iswixProperty = _iswixProperties.First(s => s.Id == newProperty.Id); iswixProperty.Value = newProperty.Value; iswixProperty.Secure = newProperty.Secure; iswixProperty.Admin = newProperty.Admin; iswixProperty.SuppressModularization = newProperty.SuppressModularization; iswixProperty.Hidden = newProperty.Hidden; } else { string oldId = string.Empty; foreach (var iswixProp in _iswixProperties) { if (!_properties.Any(s => s.Id == iswixProp.Id)) { oldId = iswixProp.Id; break; } } IsWiXProperty iswixProperty = _iswixProperties.First(s => s.Id == oldId); iswixProperty.Id = newProperty.Id; iswixProperty.Value = newProperty.Value; iswixProperty.Secure = newProperty.Secure; iswixProperty.Admin = newProperty.Admin; iswixProperty.SuppressModularization = newProperty.SuppressModularization; iswixProperty.Hidden = newProperty.Hidden; } _iswixProperties.SortXML(); } }
private void CommitChanges() { try { dataSetProperties.AcceptChanges(); dataSetProperties.Tables[0].AcceptChanges(); _properties.SortXML(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }