Beispiel #1
0
            public static TransformNode GetTransformOptions(IUIService uiService, LinkedList <TransformNode> nodes)
            {
                ImportStepOptions form = myForm;

                if (form == null)
                {
                    myForm = form = new ImportStepOptions();
                    form.TransformsCombo.SelectedValueChanged += new EventHandler(
                        delegate(object sender, EventArgs e)
                    {
                        ComboBox senderCombo       = (ComboBox)sender;
                        PropertyGrid gridControl   = ((ImportStepOptions)senderCombo.Parent).TransformOptionsPropertyGrid;
                        TransformNode selectedNode = (TransformNode)senderCombo.SelectedItem;
                        gridControl.SelectedObject = (selectedNode != null) ? selectedNode.CreateDynamicParametersTypeDescriptor() : null;
                    });
                }
                ComboBox     combo = form.TransformsCombo;
                PropertyGrid grid  = form.TransformOptionsPropertyGrid;

                ComboBox.ObjectCollection items = combo.Items;
                foreach (TransformNode node in nodes)
                {
                    items.Add(node);
                }
                combo.SelectedIndex = 0;
                if (nodes.Count == 1)
                {
                    grid.Select();
                }
                TransformNode retVal = null;

                if (DialogResult.OK == uiService.ShowDialog(form))
                {
                    TransformNode node = (TransformNode)combo.SelectedItem;
                    if (node != null)
                    {
                        node.SynchronizeArguments();
                        retVal = node;
                    }
                }
                items.Clear();
                grid.SelectedObject = null;
                return(retVal);
            }