private void cxmnuEditCategory_Click(object sender, EventArgs e) { frmSelectionBox new_frmSelectionBox = new frmSelectionBox(); new_frmSelectionBox.cbItems.Items.Clear(); List <string> bindingList = new List <string>(); string binding = ""; foreach (DataGridViewRow row in dgvSharedParameters.SelectedRows) { binding = row.Cells["clmBinding"].Value.ToString(); bindingList.Add(binding); } if (bindingList.All(o => o == bindingList[0]) && bindingList[0] == "Type") { List <string> list = new List <string>(); list = TypeCategories(); foreach (string item in list) { new_frmSelectionBox.cbItems.Items.Add(item); } } else if (bindingList.All(o => o == bindingList[0]) && bindingList[0] == "Instance") { List <string> list = new List <string>(); list = InstanceCategories(); foreach (string item in list) { new_frmSelectionBox.cbItems.Items.Add(item); } } else if (bindingList.Contains("")) { TaskDialog td = new TaskDialog("Edit Category"); td.MainInstruction = "Binding type not specified"; td.MainContent = "Binding type must be specified before setting a Category"; td.Show(); return; } else { TaskDialog td = new TaskDialog("Edit Category"); td.MainInstruction = "Multiple binding types specified"; td.MainContent = "Mulitple parameters can only be edited at once if all the binding types are the same"; td.Show(); return; } new_frmSelectionBox.Text = "Edit Category"; new_frmSelectionBox.lblInstructions.Text = "Select a category from the \ndrop-down list below"; if (new_frmSelectionBox.ShowDialog() == DialogResult.OK) { string category = new_frmSelectionBox.cbItems.SelectedItem.ToString(); foreach (DataGridViewRow row in dgvSharedParameters.SelectedRows) { row.Cells["clmCategory"].Value = category; } } }
private void cxmnuEditPropertiesGroup_Click(object sender, EventArgs e) { frmSelectionBox new_frmSelectionBox = new frmSelectionBox(); new_frmSelectionBox.cbItems.Items.Clear(); new_frmSelectionBox.cbItems.Items.Add("Analysis Results"); new_frmSelectionBox.cbItems.Items.Add("Analytical Alignment"); new_frmSelectionBox.cbItems.Items.Add("Analytical Model"); new_frmSelectionBox.cbItems.Items.Add("Constraints"); new_frmSelectionBox.cbItems.Items.Add("Construction"); new_frmSelectionBox.cbItems.Items.Add("Data"); new_frmSelectionBox.cbItems.Items.Add("Dimensions"); new_frmSelectionBox.cbItems.Items.Add("Division Geometry"); new_frmSelectionBox.cbItems.Items.Add("Electrical"); new_frmSelectionBox.cbItems.Items.Add("Electrical - Circuiting"); new_frmSelectionBox.cbItems.Items.Add("Electrical - Lighting"); new_frmSelectionBox.cbItems.Items.Add("Electrical - Loads"); new_frmSelectionBox.cbItems.Items.Add("Electrical Engineering"); new_frmSelectionBox.cbItems.Items.Add("Energy Analysis"); new_frmSelectionBox.cbItems.Items.Add("Fire Protection"); new_frmSelectionBox.cbItems.Items.Add("Forces"); new_frmSelectionBox.cbItems.Items.Add("General"); new_frmSelectionBox.cbItems.Items.Add("Graphics"); new_frmSelectionBox.cbItems.Items.Add("Green Building Properties"); new_frmSelectionBox.cbItems.Items.Add("Identity Data"); new_frmSelectionBox.cbItems.Items.Add("IFC Parameters"); new_frmSelectionBox.cbItems.Items.Add("Layers"); new_frmSelectionBox.cbItems.Items.Add("Materials and Finishes"); new_frmSelectionBox.cbItems.Items.Add("Mechanical"); new_frmSelectionBox.cbItems.Items.Add("Mechanical - Flow"); new_frmSelectionBox.cbItems.Items.Add("Mechanical - Loads"); new_frmSelectionBox.cbItems.Items.Add("Model Properties"); new_frmSelectionBox.cbItems.Items.Add("Moments"); new_frmSelectionBox.cbItems.Items.Add("Other"); new_frmSelectionBox.cbItems.Items.Add("Overall Legend"); new_frmSelectionBox.cbItems.Items.Add("Phasing"); new_frmSelectionBox.cbItems.Items.Add("Photometrics"); new_frmSelectionBox.cbItems.Items.Add("Plumbing"); new_frmSelectionBox.cbItems.Items.Add("Primary End"); new_frmSelectionBox.cbItems.Items.Add("Rebar Set"); new_frmSelectionBox.cbItems.Items.Add("Releases / Member Forces"); new_frmSelectionBox.cbItems.Items.Add("Secondary End"); new_frmSelectionBox.cbItems.Items.Add("Segments and Fittings"); new_frmSelectionBox.cbItems.Items.Add("Set"); new_frmSelectionBox.cbItems.Items.Add("Slab Shape Edit"); new_frmSelectionBox.cbItems.Items.Add("Structural"); new_frmSelectionBox.cbItems.Items.Add("Structural Analysis"); new_frmSelectionBox.cbItems.Items.Add("Text"); new_frmSelectionBox.cbItems.Items.Add("Title Text"); new_frmSelectionBox.cbItems.Items.Add("Visibility"); new_frmSelectionBox.Text = "Edit Properties Group"; new_frmSelectionBox.lblInstructions.Text = "Select the properties group from the \ndrop-down list below"; if (new_frmSelectionBox.ShowDialog() == DialogResult.OK) { string propertiesGroup = new_frmSelectionBox.cbItems.SelectedItem.ToString(); foreach (DataGridViewRow row in dgvSharedParameters.SelectedRows) { row.Cells["clmPropertiesGroup"].Value = propertiesGroup; } } }
private void cxmnuEditBinding_Click(object sender, EventArgs e) { List <string> instanceCategories = new List <string>(); instanceCategories = InstanceCategories(); List <string> typeCategories = new List <string>(); typeCategories = TypeCategories(); frmSelectionBox new_frmSelectionBox = new frmSelectionBox(); new_frmSelectionBox.cbItems.Items.Clear(); new_frmSelectionBox.cbItems.Items.Add("Instance"); new_frmSelectionBox.cbItems.Items.Add("Type"); new_frmSelectionBox.Text = "Edit Binding"; new_frmSelectionBox.lblInstructions.Text = "Select the binding type from the \ndrop-down list below"; List <string> invalidPairs = new List <string>(); if (new_frmSelectionBox.ShowDialog() == DialogResult.OK) { string binding = new_frmSelectionBox.cbItems.SelectedItem.ToString(); foreach (DataGridViewRow row in dgvSharedParameters.SelectedRows) { string category = row.Cells["clmCategory"].Value.ToString(); if (binding == "Type" && !typeCategories.Contains(category) && category != "") { invalidPairs.Add(binding + "," + category); } if (binding == "Instance" && !instanceCategories.Contains(category) && category != "") { invalidPairs.Add(binding + "," + category); } } if (invalidPairs.Count == 0) { foreach (DataGridViewRow row in dgvSharedParameters.SelectedRows) { row.Cells["clmBinding"].Value = binding; } } else { StringBuilder sb = new StringBuilder(); foreach (string item in invalidPairs) { sb.Append(item + "\n"); } TaskDialog td = new TaskDialog("Edit Binding"); td.MainInstruction = "Binding type and Category are an invalid pair"; td.MainContent = "Invalid pair(s) are listed below\n\n" + sb.ToString(); td.Show(); } } }