Exemple #1
0
        /// <summary>
        /// Creates a copy of Preset with same values.
        /// </summary>
        /// <returns>Copy of this Preset with same values.</returns>
        public Preset Copy()
        {
            Preset preset = new Preset();

            RuntimeHelper.CopyProperties(this, preset);
            return(preset);
        }
Exemple #2
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            var item = GetSelectedItems().FirstOrDefault();

            if (item != null)
            {
                var form = new SettingsItemForm();
                form.StartPosition = FormStartPosition.CenterParent;
                var newItem = Activator.CreateInstance(item.GetType());
                RuntimeHelper.CopyProperties(item, newItem);
                form.MainPropertyGrid.SelectedObject = newItem;
                var result = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    RuntimeHelper.CopyProperties(newItem, item);
                }
            }
        }