public static ExecResult <int[]> Execute(int[] alreadySelectedObjects) { var result = new ExecResult <int[]>(); try { var form = new FSelectSoftwareClassification(); form.LoadSoftwareClassification(); if (alreadySelectedObjects != null) { form.SelectSoftwareClassification(form.tvSoftwareClassification.Nodes[0], alreadySelectedObjects); } DialogResult res = form.ShowDialog(); if (res != DialogResult.OK) { result.code = (int)res; } else { List <int> selectedObjects = new List <int>(); foreach (TreeNode checkedNode in form.GetCheckedNodes(form.tvSoftwareClassification.Nodes[0])) { selectedObjects.Add(((ElementData)checkedNode.Tag)._ElementID); } result.value = selectedObjects.ToArray(); } } catch (Exception ex) { result.setException(ex); } return(result); }
private void btnSoftwareClassificationFilter_Click(object sender, EventArgs e) { ExecResult <int[]> selectSoftwareClassificationResult = FSelectSoftwareClassification.Execute((int[])lblSoftwareClassificationFilter1.Tag); if (selectSoftwareClassificationResult.code == 0) { lblSoftwareClassificationFilter1.Tag = selectSoftwareClassificationResult.value; lblSoftwareClassificationFilter1.Text = ""; for (int i = 0; i < selectSoftwareClassificationResult.value.Length; i++) { int elementDataID = selectSoftwareClassificationResult.value[i]; if (lblSoftwareClassificationFilter1.Text == "") { lblSoftwareClassificationFilter1.Text += elementDataID.ToString(); } else { lblSoftwareClassificationFilter1.Text += "," + elementDataID.ToString(); } if (i == 5) { break; } } if (lblSoftwareClassificationFilter1.Text != "") { lblSoftwareClassificationFilter1.Text += "..."; } SetFilterLabel(tpSoftwareClassificationFilter, selectSoftwareClassificationResult.value.Length > 0); LoadConnectorList(); } }