Esempio n. 1
0
        private void removeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (var selectedRow in dataGridViewProperties.SelectedRows)
            {
                DataGridViewRow row = selectedRow as DataGridViewRow;

                var properties = from a in _properties
                                 where a.Id == row.Cells[0].Value.ToString()
                                 select a;
                IsWiXProperty iswixProperty = properties.First();
                iswixProperty.Delete();
                _properties.Remove(iswixProperty);

                try
                {
                    string propertyId = row.Cells[0].Value.ToString();

                    dataGridViewProperties.Rows.Remove(row);
                }
                catch (Exception)
                {
                }
            }
            CommitChanges();
        }
Esempio n. 2
0
        public void Remove(PropertyModel selectedItem)
        {
            IsWiXProperty iswixProperty = _iswixProperties.First(s => s.Id == selectedItem.Id);

            iswixProperty.Delete();
            Properties.Remove(selectedItem);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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();
            }
        }
Esempio n. 5
0
        private void dataGridViewProperties_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            var properties = from a in _properties
                             where a.Id == _selectedPropertyId
                             select a;
            IsWiXProperty iswixProperty = properties.First();

            // Unset all attributes so they can be recreated in order
            iswixProperty.Value  = null;
            iswixProperty.Admin  = false;
            iswixProperty.Secure = false;
            iswixProperty.SuppressModularization = false;
            iswixProperty.Hidden = false;

            // Add the attributes back in order
            iswixProperty.Id     = dataGridViewProperties["idDataGridViewTextBoxColumn", e.RowIndex].Value.ToString();
            iswixProperty.Value  = dataGridViewProperties["valueDataGridViewTextBoxColumn", e.RowIndex].Value.ToString();
            iswixProperty.Admin  = (bool)dataGridViewProperties["adminDataGridViewCheckBoxColumn", e.RowIndex].Value;
            iswixProperty.Hidden = (bool)dataGridViewProperties["hiddenDataGridViewCheckBoxColumn", e.RowIndex].Value;
            iswixProperty.Secure = (bool)dataGridViewProperties["secureDataGridViewCheckBoxColumn", e.RowIndex].Value;
            iswixProperty.SuppressModularization = (bool)dataGridViewProperties["suppressModularizationDataGridViewCheckBoxColumn", e.RowIndex].Value;

            CommitChanges();
        }