public void Add() { bool added = false; Int16 index = 0; do { index++; string proposedKey = "NewProperty" + index.ToString(); if (!_iswixProperties.Any(s => s.Id == proposedKey)) { IsWiXProperty iswixProperty = _iswixProperties.Create("NewProperty" + index.ToString()); PropertyModel propertyModel = new PropertyModel(); propertyModel.Id = iswixProperty.Id; propertyModel.Value = iswixProperty.Value; propertyModel.Admin = iswixProperty.Admin; propertyModel.Hidden = iswixProperty.Hidden; propertyModel.Secure = iswixProperty.Secure; propertyModel.SuppressModularization = iswixProperty.SuppressModularization; propertyModel.PropertyChanged += PropertyModel_PropertyChanged; added = true; _iswixProperties.SortXML(); Properties.Add(propertyModel); } }while (added == false); }
private void addToolStripMenuItem_Click(object sender, EventArgs e) { bool added = false; Int16 index = 0; do { try { index++; dataSetProperties.Tables[0].Rows.Add(new object[] { "NewProperty" + index.ToString(), string.Empty, false, false, false, false }); _properties.Create("NewProperty" + index.ToString()); added = true; } catch (Exception) { } }while (added == false); CommitChanges(); }