private void btnSelectIns_Click(object sender, EventArgs e) { var form = new CheckedListForm(); foreach (string name in AvailableSignalParts) { if (!string.IsNullOrEmpty(name)) { form.AddListItem(name, edtIn.Text.Contains(name) /* TODO: Or is in signalInputList */); } } if (DialogResult.OK == form.ShowDialog()) { List <object> selectedList = form.SelectedIems; //---------------------------------// //--- Clear any existing inputs ---// //---------------------------------// edtIn.Text = ""; //------------------------------------------------------// //--- Walk each checked input from checked list form ---// //------------------------------------------------------// foreach (string name in selectedList) { //---------------------------------------------------------------------------------// //--- Add input items to in line separated by a space (backwards compatability) ---// //---------------------------------------------------------------------------------// edtIn.Text += name + @" "; } edtIn.Text = edtIn.Text.Trim(); } }
private void btnSelectIns_Click(object sender, EventArgs e) { if (_availableIns != null) { //----------------------------------------------------------------------------------// //--- Pass in "name" as the property name from the port to use as the list value ---// //----------------------------------------------------------------------------------// var form = new CheckedListForm("name"); foreach (Port port in _availableIns) { if (port.direction == PortDirection.Input || port.direction == PortDirection.BiDirectional) { form.AddListItem(port, edtIn.Text.Contains(port.name) /* TODO: Or is in signalInputList */); } } if (DialogResult.OK == form.ShowDialog()) { List <object> selectedList = form.SelectedIems; //---------------------------------// //--- Clear any existing inputs ---// //---------------------------------// if (signalInputList.SignalINs != null) { signalInputList.SignalINs.Clear(); } edtIn.Text = ""; //------------------------------------------------------// //--- Walk each checked input from checked list form ---// //------------------------------------------------------// foreach (object item in selectedList) { var port = (Port)item; //---------------------------------------------------------------------------------// //--- Add input items to in line separated by a space (backwards compatability) ---// //---------------------------------------------------------------------------------// edtIn.Text += port.name + " "; //-------------------------------// //--- Add input to input list ---// //-------------------------------// var sin = new SignalIN(); sin.name = port.name; sin.In = SignalININ.In; signalInputList.AddSignalInput(sin); } } } }
public bool ShowSelectEntitiesDialog(SelectEntitiesDialogOptions options, out List <string> selected) { using (CheckedListForm form = new CheckedListForm()) { form.Text = options.Caption; form.InitializeDialog(options.Description, options.Options, options.Checked, this, this); System.Windows.Forms.DialogResult formsResult = form.ShowDialog(); selected = new List <string>(); bool isOk = formsResult == DialogResult.OK; if (isOk) { selected = form.GetSelectedItems(); } return(isOk); } }
private void btnSelectOuts_Click(object sender, EventArgs e) { if (_availableOuts != null) { //----------------------------------------------------------------------------------// //--- Pass in "name" as the property name from the port to use as the list value ---// //----------------------------------------------------------------------------------// var form = new CheckedListForm("name"); foreach (Port port in _availableOuts) { if (port.direction == PortDirection.Output || port.direction == PortDirection.BiDirectional) { form.AddListItem(port, edtOut.Text.Contains(port.name)); } } if (DialogResult.OK == form.ShowDialog()) { List <object> selectedList = form.SelectedIems; //---------------------------------// //--- Clear any existing inputs ---// //---------------------------------// edtOut.Text = ""; //------------------------------------------------------// //--- Walk each checked input from checked list form ---// //------------------------------------------------------// foreach (object item in selectedList) { var port = (Port)item; //----------------------------------------------------------------------------------// //--- Add output items to in line separated by a space (backwards compatability) ---// //----------------------------------------------------------------------------------// edtOut.Text += port.name + " "; } } } }