private void btnRemoveConstant_Click(object sender, EventArgs e) { if (lstConstants.SelectedItems.Count > 0) { string constName = lstConstants.SelectedItems[0].SubItems[0].Text; string message = string.Format("Delete constant '{0}'?", constName); if (MessageBox.Show(message, "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Project.Constant[] newConsts = new ArchAngel.Designer.Project.Constant[Project.Instance.Constants.Length - 1]; int insertPos = 0; for (int i = 0; i < Project.Instance.Constants.Length; i++) { if (Project.Instance.Constants[i].Name != constName) { newConsts[insertPos] = Project.Instance.Constants[i]; insertPos++; } } Project.Instance.Constants = newConsts; Project.Instance.IsDirty = true; Controller.MainForm.PopulateConstantsList(); Populate(); } } }
private void btnRemoveConstant_Click(object sender, EventArgs e) { if (lstConstants.SelectedItems.Count > 0) { string constName = lstConstants.SelectedItems[0].SubItems[0].Text; string message = string.Format("Delete constant '{0}'?", constName); if (MessageBox.Show(message, "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Project.Constant[] newConsts = new ArchAngel.Designer.Project.Constant[Project.Instance.Constants.Length - 1]; int insertPos = 0; for (int i = 0; i < Project.Instance.Constants.Length; i++) { if (Project.Instance.Constants[i].Name != constName) { newConsts[insertPos] = Project.Instance.Constants[i]; insertPos++; } } Project.Instance.Constants = newConsts; Project.Instance.IsDirty = true; Controller.MainForm.PopulateConstantsList(); Populate(); } } }