private void btnAddConstant_Click(object sender, EventArgs e) { if (txtConstName.TextLength == 0) { MessageBox.Show("Name is missing.", "Missing data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } bool assignedAtRuntime = (ddlConstType.Text == "Runtime"); string value = assignedAtRuntime ? ddlConstantFunctions.Text : txtValue.Text; if (AddingNew) { Project.Constant con = new Project.Constant(txtConstName.Text, ddlConstType.Text, value);//, assignedAtRuntime); Project.Instance.AddConstant(con); } else // Editing existing Constant { Project.Constant con = Project.Instance.FindConstant(OriginalName); con.Name = txtConstName.Text; con.DataType = ddlConstType.Text; con.Value = con.DataType == "Runtime" ? ddlConstantFunctions.Text : txtValue.Text; //con.IsAssignedAtRuntime = con.DataType == "Runtime"; } Project.Instance.IsDirty = true; SaveClicked = true; this.Close(); }
private void btnAddConstant_Click(object sender, EventArgs e) { if (txtConstName.TextLength == 0) { MessageBox.Show("Name is missing.", "Missing data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } bool assignedAtRuntime = (ddlConstType.Text == "Runtime"); string value = assignedAtRuntime ? ddlConstantFunctions.Text : txtValue.Text; if (AddingNew) { Project.Constant con = new Project.Constant(txtConstName.Text, ddlConstType.Text, value); //, assignedAtRuntime); Project.Instance.AddConstant(con); } else // Editing existing Constant { Project.Constant con = Project.Instance.FindConstant(OriginalName); con.Name = txtConstName.Text; con.DataType = ddlConstType.Text; con.Value = con.DataType == "Runtime" ? ddlConstantFunctions.Text : txtValue.Text; //con.IsAssignedAtRuntime = con.DataType == "Runtime"; } Project.Instance.IsDirty = true; SaveClicked = true; this.Close(); }