private void btnSourceElementFilter_Click(object sender, EventArgs e) { ExecResult <int[]> selectDiagramObjectsResult = FSelectDiagramObjects.Execute((int[])lblSourceElementFilter.Tag); if (selectDiagramObjectsResult.code == 0) { lblSourceElementFilter.Tag = selectDiagramObjectsResult.value; lblSourceElementFilter.Text = ""; for (int i = 0; i < selectDiagramObjectsResult.value.Length; i++) { int elementID = selectDiagramObjectsResult.value[i]; if (lblSourceElementFilter.Text == "") { lblSourceElementFilter.Text += elementID.ToString(); } else { lblSourceElementFilter.Text += "," + elementID.ToString(); } if (i == 5) { break; } } if (lblSourceElementFilter.Text != "") { lblSourceElementFilter.Text += "..."; } SetFilterLabel(tpSourceElementFilter, selectDiagramObjectsResult.value.Length > 0); LoadConnectorList(); } }
public static ExecResult <int[]> Execute(int[] alreadySelectedObjects) { var result = new ExecResult <int[]>(); try { var form = new FSelectDiagramObjects(); form.LoadDiagramObjects(); if (alreadySelectedObjects != null) { form.SelectObjects(alreadySelectedObjects); } DialogResult res = form.ShowDialog(); if (res != DialogResult.OK) { result.code = (int)res; } else { List <int> selectedObjIDs = new List <int>(); foreach (ListViewItem item in form.lvDiagramObjects.SelectedItems) { selectedObjIDs.Add(((ElementData)item.Tag)._ElementID); } result.value = selectedObjIDs.ToArray(); } } catch (Exception ex) { result.setException(ex); } return(result); }